* 当body 为 FileBufferingReadStream,可能会出现request.Body.Length=0的情况

* 修改package id 避免下载到原版
* 发布到nuget.org
This commit is contained in:
nsnail 2022-09-08 17:56:38 +08:00
parent 36ad6e1e78
commit c2eb375f91
3 changed files with 186 additions and 160 deletions

24
nuget/build-and-push.ps1 Normal file
View File

@ -0,0 +1,24 @@
# ¶¨Òå²ÎÊý
Param(
# Nuget APIKey
[string] $apikey
)
if ($apikey -eq $null -or $apikey -eq "")
{
Write-Error "±ØÐëÖ¸¶¨apiKey";
return;
}
rm -r ../src/Ocelot/bin/Release
dotnet build -c Release ../Ocelot.sln
$files = Get-ChildItem -Path ../src/Ocelot/bin/Release -Filter *-ns*.nupkg
foreach($file in $files)
{
dotnet nuget push $file.fullName --skip-duplicate --api-key $apikey --source https://api.nuget.org/v3/index.json
}
$files = Get-ChildItem -Path ../src/Ocelot/bin/Release -Filter *-ns*.snupkg
foreach($file in $files)
{
dotnet nuget push $file.fullName --skip-duplicate --api-key $apikey --source https://api.nuget.org/v3/index.json
}

View File

@ -4,9 +4,9 @@
<NoPackageAnalysis>true</NoPackageAnalysis>
<Description>Ocelot is an API Gateway. The project is aimed at people using .NET running a micro services / service orientated architecture that need a unified point of entry into their system. In particular I want easy integration with IdentityServer reference and bearer tokens. reference tokens. Ocelot is a bunch of middlewares in a specific order. Ocelot manipulates the HttpRequest object into a state specified by its configuration until it reaches a request builder middleware where it creates a HttpRequestMessage object which is used to make a request to a downstream service. The middleware that makes the request is the last thing in the Ocelot pipeline. It does not call the next middleware. The response from the downstream service is stored in a per request scoped repository and retrived as the requests goes back up the Ocelot pipeline. There is a piece of middleware that maps the HttpResponseMessage onto the HttpResponse object and that is returned to the client. That is basically it with a bunch of other features.</Description>
<AssemblyTitle>Ocelot</AssemblyTitle>
<VersionPrefix>0.0.0-dev</VersionPrefix>
<VersionPrefix>18.0.1-ns1</VersionPrefix>
<AssemblyName>Ocelot</AssemblyName>
<PackageId>Ocelot</PackageId>
<PackageId>Ocelot.NS</PackageId>
<PackageTags>API Gateway;.NET core</PackageTags>
<PackageProjectUrl>https://github.com/ThreeMammals/Ocelot</PackageProjectUrl>
<PackageIconUrl>http://github.com/images/ocelot_logo.png</PackageIconUrl>

View File

@ -40,7 +40,9 @@
private async Task<HttpContent> MapContent(HttpRequest request)
{
if (request.Body == null || (request.Body.CanSeek && request.Body.Length <= 0))
// if (request.Body == null || (request.Body.CanSeek && request.Body.Length)
// ↑ 当body 为 FileBufferingReadStream可能会出现request.Body.Length=0的情况 那么 就会漏掉后续的流程 。修改为 ↓
if (request.Body.CanSeek && request.Body.Length <= 0 && (request.ContentLength ?? 0) <=0)
{
return null;
}