Feature/websockets (#273)

* #212 - hacked websockets proxy together

* faffing around

* #212 hacking away :(

* #212 websockets proxy middleware working

* #212 map when for webockets working

* #212 some test refactor

* #212 temp commit

* #212 websockets proxy working, tests passing...need to do some tidying and write docs

* #212 more code coverage

* #212 docs for websockets

* #212 updated readme

* #212 tidying up after websockets refactoring

* #212 tidying up after websockets refactoring

* #212 tidying up after websockets refactoring

* stuck a warning in about logging levels into docs!
This commit is contained in:
Tom Pallister
2018-03-23 18:01:02 +00:00
committed by GitHub
parent 4493b22d0d
commit 463a7bdab4
80 changed files with 1539 additions and 369 deletions

View File

@ -20,6 +20,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator
using Xunit;
using Shouldly;
using Microsoft.AspNetCore.Http;
using Ocelot.Request.Middleware;
public class DownstreamUrlCreatorMiddlewareTests
{
@ -30,6 +31,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator
private DownstreamUrlCreatorMiddleware _middleware;
private DownstreamContext _downstreamContext;
private OcelotRequestDelegate _next;
private HttpRequestMessage _request;
public DownstreamUrlCreatorMiddlewareTests()
{
@ -38,7 +40,8 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator
_logger = new Mock<IOcelotLogger>();
_loggerFactory.Setup(x => x.CreateLogger<DownstreamUrlCreatorMiddleware>()).Returns(_logger.Object);
_downstreamUrlTemplateVariableReplacer = new Mock<IDownstreamPathPlaceholderReplacer>();
_downstreamContext.DownstreamRequest = new HttpRequestMessage(HttpMethod.Get, "https://my.url/abc/?q=123");
_request = new HttpRequestMessage(HttpMethod.Get, "https://my.url/abc/?q=123");
_downstreamContext.DownstreamRequest = new DownstreamRequest(_request);
_next = context => Task.CompletedTask;
}
@ -208,7 +211,9 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator
private void GivenTheDownstreamRequestUriIs(string uri)
{
_downstreamContext.DownstreamRequest.RequestUri = new Uri(uri);
_request.RequestUri = new Uri(uri);
//todo - not sure if needed
_downstreamContext.DownstreamRequest = new DownstreamRequest(_request);
}
private void GivenTheUrlReplacerWillReturn(string path)
@ -221,7 +226,7 @@ namespace Ocelot.UnitTests.DownstreamUrlCreator
private void ThenTheDownstreamRequestUriIs(string expectedUri)
{
_downstreamContext.DownstreamRequest.RequestUri.OriginalString.ShouldBe(expectedUri);
_downstreamContext.DownstreamRequest.ToHttpRequestMessage().RequestUri.OriginalString.ShouldBe(expectedUri);
}
}
}