regex for url match, means annoying constructor ocelot configuration object but cant work out a better way to do this at the moment

This commit is contained in:
TomPallister
2016-10-09 15:40:13 +01:00
parent f8ea87c91b
commit 1fddcf0836
38 changed files with 675 additions and 288 deletions

View File

@@ -5,12 +5,13 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Ocelot.Library.Infrastructure.Responses;
namespace Ocelot.Library.Infrastructure.RequestBuilder
{
public class HttpRequestBuilder : IRequestBuilder
{
public async Task<Request> Build(string httpMethod, string downstreamUrl, Stream content, IHeaderDictionary headers,
public async Task<Response<Request>> Build(string httpMethod, string downstreamUrl, Stream content, IHeaderDictionary headers,
IRequestCookieCollection cookies, string queryString, string contentType)
{
var method = new HttpMethod(httpMethod);
@@ -64,9 +65,8 @@ namespace Ocelot.Library.Infrastructure.RequestBuilder
cookieContainer.Add(uri, new Cookie(cookie.Key, cookie.Value));
}
}
return new Request(httpRequestMessage, cookieContainer);
return new OkResponse<Request>(new Request(httpRequestMessage, cookieContainer));
}
}
}

View File

@@ -1,12 +1,13 @@
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Ocelot.Library.Infrastructure.Responses;
namespace Ocelot.Library.Infrastructure.RequestBuilder
{
public interface IRequestBuilder
{
Task<Request> Build(string httpMethod,
Task<Response<Request>> Build(string httpMethod,
string downstreamUrl,
Stream content,
IHeaderDictionary headers,