mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-04-22 06:22:50 +08:00
* #464 added code to request mapper to not automatically add content type and content length headers, .net will automatically try and add these headers in a few circumstances but this solves the 464 issue * #464 use seek instead of read on body check for websockets tests * #464 ran out of inodes on linux, looks like reloadonchange causes this
This commit is contained in:
parent
12ef3bc00f
commit
23c5fcbf91
@ -22,7 +22,7 @@
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("ocelot.json")
|
.AddJsonFile("ocelot.json", false, false)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
|
@ -106,7 +106,7 @@ namespace OcelotGraphQL
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("ocelot.json")
|
.AddJsonFile("ocelot.json", false, false)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s => {
|
.ConfigureServices(s => {
|
||||||
|
@ -59,7 +59,6 @@ namespace OcelotApplicationApiGateway
|
|||||||
{
|
{
|
||||||
this.webHost = new WebHostBuilder()
|
this.webHost = new WebHostBuilder()
|
||||||
.UseKestrel()
|
.UseKestrel()
|
||||||
//.UseStartup<Startup>()
|
|
||||||
.UseUrls(this.listeningAddress)
|
.UseUrls(this.listeningAddress)
|
||||||
.ConfigureAppConfiguration((hostingContext, config) =>
|
.ConfigureAppConfiguration((hostingContext, config) =>
|
||||||
{
|
{
|
||||||
@ -67,7 +66,7 @@ namespace OcelotApplicationApiGateway
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("ocelot.json")
|
.AddJsonFile("ocelot.json", false, false)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
|
@ -71,7 +71,7 @@ namespace Ocelot.DependencyInjection
|
|||||||
|
|
||||||
File.WriteAllText("ocelot.json", json);
|
File.WriteAllText("ocelot.json", json);
|
||||||
|
|
||||||
builder.AddJsonFile("ocelot.json");
|
builder.AddJsonFile("ocelot.json", false, false);
|
||||||
|
|
||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,6 @@
|
|||||||
|
|
||||||
public interface IRequestMapper
|
public interface IRequestMapper
|
||||||
{
|
{
|
||||||
Task<Response<HttpRequestMessage>> Map(HttpRequest request);
|
Response<HttpRequestMessage> Map(HttpRequest request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
{
|
{
|
||||||
private readonly string[] _unsupportedHeaders = { "host" };
|
private readonly string[] _unsupportedHeaders = { "host" };
|
||||||
|
|
||||||
public async Task<Response<HttpRequestMessage>> Map(HttpRequest request)
|
public Response<HttpRequestMessage> Map(HttpRequest request)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var requestMessage = new HttpRequestMessage()
|
var requestMessage = new HttpRequestMessage()
|
||||||
{
|
{
|
||||||
Content = await MapContent(request),
|
Content = MapContent(request),
|
||||||
Method = MapMethod(request),
|
Method = MapMethod(request),
|
||||||
RequestUri = MapUri(request)
|
RequestUri = MapUri(request)
|
||||||
};
|
};
|
||||||
@ -36,17 +36,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<HttpContent> MapContent(HttpRequest request)
|
private HttpContent MapContent(HttpRequest request)
|
||||||
{
|
{
|
||||||
if (request.Body == null)
|
if (request.Body == null || (request.Body.CanSeek && request.Body.Length <= 0))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var content = new ByteArrayContent(await ToByteArray(request.Body));
|
var content = new StreamContent(request.Body);
|
||||||
|
|
||||||
|
if(!string.IsNullOrEmpty(request.ContentType))
|
||||||
|
{
|
||||||
content.Headers
|
content.Headers
|
||||||
.TryAddWithoutValidation("Content-Type", new[] {request.ContentType});
|
.TryAddWithoutValidation("Content-Type", new[] {request.ContentType});
|
||||||
|
}
|
||||||
|
|
||||||
AddHeaderIfExistsOnRequest("Content-Language", content, request);
|
AddHeaderIfExistsOnRequest("Content-Language", content, request);
|
||||||
AddHeaderIfExistsOnRequest("Content-Location", content, request);
|
AddHeaderIfExistsOnRequest("Content-Location", content, request);
|
||||||
@ -88,18 +91,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<byte[]> ToByteArray(Stream stream)
|
|
||||||
{
|
|
||||||
using (stream)
|
|
||||||
{
|
|
||||||
using (var memStream = new MemoryStream())
|
|
||||||
{
|
|
||||||
await stream.CopyToAsync(memStream);
|
|
||||||
return memStream.ToArray();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsSupportedHeader(KeyValuePair<string, StringValues> header)
|
private bool IsSupportedHeader(KeyValuePair<string, StringValues> header)
|
||||||
{
|
{
|
||||||
return !_unsupportedHeaders.Contains(header.Key.ToLower());
|
return !_unsupportedHeaders.Contains(header.Key.ToLower());
|
||||||
|
@ -27,7 +27,7 @@ namespace Ocelot.Request.Middleware
|
|||||||
|
|
||||||
public async Task Invoke(DownstreamContext context)
|
public async Task Invoke(DownstreamContext context)
|
||||||
{
|
{
|
||||||
var downstreamRequest = await _requestMapper.Map(context.HttpContext.Request);
|
var downstreamRequest = _requestMapper.Map(context.HttpContext.Request);
|
||||||
|
|
||||||
if (downstreamRequest.IsError)
|
if (downstreamRequest.IsError)
|
||||||
{
|
{
|
||||||
|
190
test/Ocelot.AcceptanceTests/ContentTests.cs
Normal file
190
test/Ocelot.AcceptanceTests/ContentTests.cs
Normal file
@ -0,0 +1,190 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
|
using Microsoft.AspNetCore.Builder;
|
||||||
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
using Microsoft.AspNetCore.Http;
|
||||||
|
using Ocelot.Configuration.File;
|
||||||
|
using Shouldly;
|
||||||
|
using TestStack.BDDfy;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Ocelot.AcceptanceTests
|
||||||
|
{
|
||||||
|
public class ContentTests : IDisposable
|
||||||
|
{
|
||||||
|
private IWebHost _builder;
|
||||||
|
private readonly Steps _steps;
|
||||||
|
private string _contentType;
|
||||||
|
private long? _contentLength;
|
||||||
|
private bool _contentTypeHeaderExists;
|
||||||
|
|
||||||
|
public ContentTests()
|
||||||
|
{
|
||||||
|
_steps = new Steps();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void should_not_add_content_type_or_content_length_headers()
|
||||||
|
{
|
||||||
|
var configuration = new FileConfiguration
|
||||||
|
{
|
||||||
|
ReRoutes = new List<FileReRoute>
|
||||||
|
{
|
||||||
|
new FileReRoute
|
||||||
|
{
|
||||||
|
DownstreamPathTemplate = "/",
|
||||||
|
DownstreamScheme = "http",
|
||||||
|
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||||
|
{
|
||||||
|
new FileHostAndPort
|
||||||
|
{
|
||||||
|
Host = "localhost",
|
||||||
|
Port = 51339,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
UpstreamPathTemplate = "/",
|
||||||
|
UpstreamHttpMethod = new List<string> { "Get" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51339", "/", 200, "Hello from Laura"))
|
||||||
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
|
.When(x => _steps.WhenIGetUrlOnTheApiGateway("/"))
|
||||||
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.OK))
|
||||||
|
.And(x => _steps.ThenTheResponseBodyShouldBe("Hello from Laura"))
|
||||||
|
.And(x => ThenTheContentTypeShouldBeEmpty())
|
||||||
|
.And(x => ThenTheContentLengthShouldBeEmpty())
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void should_add_content_type_and_content_length_headers()
|
||||||
|
{
|
||||||
|
var configuration = new FileConfiguration
|
||||||
|
{
|
||||||
|
ReRoutes = new List<FileReRoute>
|
||||||
|
{
|
||||||
|
new FileReRoute
|
||||||
|
{
|
||||||
|
DownstreamPathTemplate = "/",
|
||||||
|
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||||
|
{
|
||||||
|
new FileHostAndPort
|
||||||
|
{
|
||||||
|
Host = "localhost",
|
||||||
|
Port = 51349,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DownstreamScheme = "http",
|
||||||
|
UpstreamPathTemplate = "/",
|
||||||
|
UpstreamHttpMethod = new List<string> { "Post" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var contentType = "application/json";
|
||||||
|
|
||||||
|
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51349", "/", 201, string.Empty))
|
||||||
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
|
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||||
|
.And(x => _steps.GivenThePostHasContentType(contentType))
|
||||||
|
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||||
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||||
|
.And(x => ThenTheContentLengthIs(11))
|
||||||
|
.And(x => ThenTheContentTypeIsIs(contentType))
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void should_add_default_content_type_header()
|
||||||
|
{
|
||||||
|
var configuration = new FileConfiguration
|
||||||
|
{
|
||||||
|
ReRoutes = new List<FileReRoute>
|
||||||
|
{
|
||||||
|
new FileReRoute
|
||||||
|
{
|
||||||
|
DownstreamPathTemplate = "/",
|
||||||
|
DownstreamHostAndPorts = new List<FileHostAndPort>
|
||||||
|
{
|
||||||
|
new FileHostAndPort
|
||||||
|
{
|
||||||
|
Host = "localhost",
|
||||||
|
Port = 51359,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
DownstreamScheme = "http",
|
||||||
|
UpstreamPathTemplate = "/",
|
||||||
|
UpstreamHttpMethod = new List<string> { "Post" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.Given(x => x.GivenThereIsAServiceRunningOn("http://localhost:51359", "/", 201, string.Empty))
|
||||||
|
.And(x => _steps.GivenThereIsAConfiguration(configuration))
|
||||||
|
.And(x => _steps.GivenOcelotIsRunning())
|
||||||
|
.And(x => _steps.GivenThePostHasContent("postContent"))
|
||||||
|
.When(x => _steps.WhenIPostUrlOnTheApiGateway("/"))
|
||||||
|
.Then(x => _steps.ThenTheStatusCodeShouldBe(HttpStatusCode.Created))
|
||||||
|
.And(x => ThenTheContentLengthIs(11))
|
||||||
|
.And(x => ThenTheContentTypeIsIs("text/plain; charset=utf-8"))
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThenTheContentTypeIsIs(string expected)
|
||||||
|
{
|
||||||
|
_contentType.ShouldBe(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThenTheContentLengthShouldBeEmpty()
|
||||||
|
{
|
||||||
|
_contentLength.ShouldBeNull();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThenTheContentLengthIs(int expected)
|
||||||
|
{
|
||||||
|
_contentLength.ShouldBe(expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ThenTheContentTypeShouldBeEmpty()
|
||||||
|
{
|
||||||
|
_contentType.ShouldBeNullOrEmpty();
|
||||||
|
_contentTypeHeaderExists.ShouldBe(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GivenThereIsAServiceRunningOn(string baseUrl, string basePath, int statusCode, string responseBody)
|
||||||
|
{
|
||||||
|
_builder = new WebHostBuilder()
|
||||||
|
.UseUrls(baseUrl)
|
||||||
|
.UseKestrel()
|
||||||
|
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||||
|
.UseIISIntegration()
|
||||||
|
.Configure(app =>
|
||||||
|
{
|
||||||
|
app.UsePathBase(basePath);
|
||||||
|
app.Run(async context =>
|
||||||
|
{
|
||||||
|
_contentType = context.Request.ContentType;
|
||||||
|
_contentLength = context.Request.ContentLength;
|
||||||
|
_contentTypeHeaderExists = context.Request.Headers.TryGetValue("Content-Type", out var value);
|
||||||
|
context.Response.StatusCode = statusCode;
|
||||||
|
await context.Response.WriteAsync(responseBody);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
_builder.Start();
|
||||||
|
}
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
_builder?.Dispose();
|
||||||
|
_steps.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -68,9 +68,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
@ -126,9 +126,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -154,9 +154,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -197,9 +197,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -228,9 +228,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -261,9 +261,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -294,9 +294,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -326,9 +326,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -357,9 +357,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -396,9 +396,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -444,9 +444,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -481,9 +481,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -509,9 +509,9 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s =>
|
.ConfigureServices(s =>
|
||||||
@ -570,8 +570,8 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
var builder = new ConfigurationBuilder()
|
var builder = new ConfigurationBuilder()
|
||||||
.SetBasePath(Directory.GetCurrentDirectory())
|
.SetBasePath(Directory.GetCurrentDirectory())
|
||||||
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile("ocelot.json")
|
.AddJsonFile("ocelot.json", false, false)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
|
|
||||||
var configuration = builder.Build();
|
var configuration = builder.Build();
|
||||||
@ -823,6 +823,11 @@ namespace Ocelot.AcceptanceTests
|
|||||||
_postContent = new StringContent(postcontent);
|
_postContent = new StringContent(postcontent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void GivenThePostHasContentType(string postcontent)
|
||||||
|
{
|
||||||
|
_postContent.Headers.ContentType = new MediaTypeHeaderValue(postcontent);
|
||||||
|
}
|
||||||
|
|
||||||
public void GivenThePostHasGzipContent(object input)
|
public void GivenThePostHasGzipContent(object input)
|
||||||
{
|
{
|
||||||
var json = JsonConvert.SerializeObject(input);
|
var json = JsonConvert.SerializeObject(input);
|
||||||
|
@ -341,8 +341,8 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
@ -387,8 +387,8 @@ namespace Ocelot.AcceptanceTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureLogging((hostingContext, logging) =>
|
.ConfigureLogging((hostingContext, logging) =>
|
||||||
|
@ -99,7 +99,7 @@ namespace Ocelot.Benchmarks
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("ocelot.json")
|
.AddJsonFile("ocelot.json", false, false)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s => {
|
.ConfigureServices(s => {
|
||||||
|
@ -536,9 +536,9 @@ namespace Ocelot.IntegrationTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x =>
|
.ConfigureServices(x =>
|
||||||
@ -660,9 +660,9 @@ namespace Ocelot.IntegrationTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x => {
|
.ConfigureServices(x => {
|
||||||
@ -693,9 +693,9 @@ namespace Ocelot.IntegrationTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x =>
|
.ConfigureServices(x =>
|
||||||
@ -733,9 +733,9 @@ namespace Ocelot.IntegrationTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x => {
|
.ConfigureServices(x => {
|
||||||
|
@ -446,10 +446,10 @@ namespace Ocelot.IntegrationTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddJsonFile("peers.json", optional: true, reloadOnChange: true);
|
config.AddJsonFile("peers.json", optional: true, reloadOnChange: false);
|
||||||
#pragma warning disable CS0618
|
#pragma warning disable CS0618
|
||||||
config.AddOcelotBaseUrl(url);
|
config.AddOcelotBaseUrl(url);
|
||||||
#pragma warning restore CS0618
|
#pragma warning restore CS0618
|
||||||
|
@ -106,9 +106,9 @@ namespace Ocelot.IntegrationTests
|
|||||||
{
|
{
|
||||||
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
config.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath);
|
||||||
var env = hostingContext.HostingEnvironment;
|
var env = hostingContext.HostingEnvironment;
|
||||||
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
|
config.AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
|
||||||
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: false);
|
||||||
config.AddJsonFile("ocelot.json");
|
config.AddJsonFile("ocelot.json", false, false);
|
||||||
config.AddEnvironmentVariables();
|
config.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(x =>
|
.ConfigureServices(x =>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
.SetBasePath(hostingContext.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", true, true)
|
.AddJsonFile("appsettings.json", true, true)
|
||||||
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
.AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true, true)
|
||||||
.AddJsonFile("ocelot.json")
|
.AddJsonFile("ocelot.json", false, false)
|
||||||
.AddEnvironmentVariables();
|
.AddEnvironmentVariables();
|
||||||
})
|
})
|
||||||
.ConfigureServices(s => {
|
.ConfigureServices(s => {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
"DownstreamHostAndPorts": [
|
"DownstreamHostAndPorts": [
|
||||||
{
|
{
|
||||||
"Host": "localhost",
|
"Host": "localhost",
|
||||||
"Port": 3000
|
"Port": 5001
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"QoSOptions": {
|
"QoSOptions": {
|
||||||
|
@ -95,7 +95,7 @@ namespace Ocelot.UnitTests.Request
|
|||||||
|
|
||||||
_requestMapper
|
_requestMapper
|
||||||
.Setup(rm => rm.Map(It.IsAny<HttpRequest>()))
|
.Setup(rm => rm.Map(It.IsAny<HttpRequest>()))
|
||||||
.ReturnsAsync(_mappedRequest);
|
.Returns(_mappedRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenTheMapperWillReturnAnError()
|
private void GivenTheMapperWillReturnAnError()
|
||||||
@ -104,7 +104,7 @@ namespace Ocelot.UnitTests.Request
|
|||||||
|
|
||||||
_requestMapper
|
_requestMapper
|
||||||
.Setup(rm => rm.Map(It.IsAny<HttpRequest>()))
|
.Setup(rm => rm.Map(It.IsAny<HttpRequest>()))
|
||||||
.ReturnsAsync(_mappedRequest);
|
.Returns(_mappedRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WhenTheMiddlewareIsInvoked()
|
private void WhenTheMiddlewareIsInvoked()
|
||||||
|
@ -121,7 +121,7 @@
|
|||||||
[Fact]
|
[Fact]
|
||||||
public void Should_handle_no_content()
|
public void Should_handle_no_content()
|
||||||
{
|
{
|
||||||
this.Given(_ => GivenTheInputRequestHasNoContent())
|
this.Given(_ => GivenTheInputRequestHasNullContent())
|
||||||
.And(_ => GivenTheInputRequestHasMethod("GET"))
|
.And(_ => GivenTheInputRequestHasMethod("GET"))
|
||||||
.And(_ => GivenTheInputRequestHasAValidUri())
|
.And(_ => GivenTheInputRequestHasAValidUri())
|
||||||
.When(_ => WhenMapped())
|
.When(_ => WhenMapped())
|
||||||
@ -130,6 +130,40 @@
|
|||||||
.BDDfy();
|
.BDDfy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Should_handle_no_content_type()
|
||||||
|
{
|
||||||
|
this.Given(_ => GivenTheInputRequestHasNoContentType())
|
||||||
|
.And(_ => GivenTheInputRequestHasMethod("GET"))
|
||||||
|
.And(_ => GivenTheInputRequestHasAValidUri())
|
||||||
|
.When(_ => WhenMapped())
|
||||||
|
.Then(_ => ThenNoErrorIsReturned())
|
||||||
|
.And(_ => ThenTheMappedRequestHasNoContent())
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void Should_handle_no_content_length()
|
||||||
|
{
|
||||||
|
this.Given(_ => GivenTheInputRequestHasNoContentLength())
|
||||||
|
.And(_ => GivenTheInputRequestHasMethod("GET"))
|
||||||
|
.And(_ => GivenTheInputRequestHasAValidUri())
|
||||||
|
.When(_ => WhenMapped())
|
||||||
|
.Then(_ => ThenNoErrorIsReturned())
|
||||||
|
.And(_ => ThenTheMappedRequestHasNoContent())
|
||||||
|
.BDDfy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GivenTheInputRequestHasNoContentLength()
|
||||||
|
{
|
||||||
|
_inputRequest.ContentLength = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GivenTheInputRequestHasNoContentType()
|
||||||
|
{
|
||||||
|
_inputRequest.ContentType = null;
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Should_map_content_headers()
|
public void Should_map_content_headers()
|
||||||
{
|
{
|
||||||
@ -339,14 +373,14 @@
|
|||||||
_inputRequest.Body = new MemoryStream(Encoding.UTF8.GetBytes(content));
|
_inputRequest.Body = new MemoryStream(Encoding.UTF8.GetBytes(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GivenTheInputRequestHasNoContent()
|
private void GivenTheInputRequestHasNullContent()
|
||||||
{
|
{
|
||||||
_inputRequest.Body = null;
|
_inputRequest.Body = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WhenMapped()
|
private void WhenMapped()
|
||||||
{
|
{
|
||||||
_mappedRequest = _requestMapper.Map(_inputRequest).GetAwaiter().GetResult();
|
_mappedRequest = _requestMapper.Map(_inputRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ThenNoErrorIsReturned()
|
private void ThenNoErrorIsReturned()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user