mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-12-24 21:15:49 +08:00
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:
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user