mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 06:38:14 +08:00
I realised we can get rid of the cookie container as cookies are just sent as a header called cookie...
This commit is contained in:
@ -195,23 +195,6 @@ namespace Ocelot.UnitTests.Request
|
||||
_qoSProvider = qoSProvider;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_use_cookies()
|
||||
{
|
||||
this.Given(x => x.GivenIHaveHttpMethod("GET"))
|
||||
.And(x => x.GivenIHaveDownstreamUrl("http://www.bbc.co.uk"))
|
||||
.And(x => x.GivenTheCookiesAre(new RequestCookieCollection(new Dictionary<string, string>
|
||||
{
|
||||
{ "TheCookie","Monster" }
|
||||
})))
|
||||
.When(x => x.WhenICreateARequest())
|
||||
.And(x => x.ThenTheCorrectCookiesAreUsed(new RequestCookieCollection(new Dictionary<string, string>
|
||||
{
|
||||
{ "TheCookie","Monster" }
|
||||
})))
|
||||
.BDDfy();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void should_user_query_string()
|
||||
{
|
||||
@ -240,14 +223,14 @@ namespace Ocelot.UnitTests.Request
|
||||
|
||||
private void ThenTheCorrectCookiesAreUsed(IRequestCookieCollection expected)
|
||||
{
|
||||
var resultCookies = _result.Data.CookieContainer.GetCookies(new Uri(_downstreamUrl + _query));
|
||||
/* var resultCookies = _result.Data.CookieContainer.GetCookies(new Uri(_downstreamUrl + _query));
|
||||
var resultDictionary = resultCookies.Cast<Cookie>().ToDictionary(cook => cook.Name, cook => cook.Value);
|
||||
|
||||
foreach (var expectedCookie in expected)
|
||||
{
|
||||
var resultCookie = resultDictionary[expectedCookie.Key];
|
||||
resultCookie.ShouldBe(expectedCookie.Value);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private void GivenTheCookiesAre(IRequestCookieCollection cookies)
|
||||
@ -305,7 +288,7 @@ namespace Ocelot.UnitTests.Request
|
||||
private void WhenICreateARequest()
|
||||
{
|
||||
_result = _requestCreator.Build(_httpMethod, _downstreamUrl, _content?.ReadAsStreamAsync().Result, _headers,
|
||||
_cookies, _query, _contentType, _requestId,_isQos,_qoSProvider).Result;
|
||||
_query, _contentType, _requestId,_isQos,_qoSProvider).Result;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user