Skip to content

Commit

Permalink
Replaced httpbin with httpbingo
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianRappl committed Jan 15, 2023
1 parent 9cd36df commit f11e802
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 39 deletions.
27 changes: 11 additions & 16 deletions src/AngleSharp.Io.Tests/Cookie/ClassicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public async Task SettingOneCookiesInOneRequestAppearsInDocument()
{
if (Helper.IsNetworkAvailable())
{
var url = "https://httpbin.org/cookies/set?k1=v1";
var url = "https://httpbingo.org/cookies/set?k1=v1";
var config = Configuration.Default.WithCookies().WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(url);
Expand All @@ -206,7 +206,7 @@ public async Task SettingTwoCookiesInOneRequestAppearsInDocument()
{
if (Helper.IsNetworkAvailable())
{
var url = "https://httpbin.org/cookies/set?k2=v2&k1=v1";
var url = "https://httpbingo.org/cookies/set?k2=v2&k1=v1";
var config = Configuration.Default.WithCookies().WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(url);
Expand All @@ -221,7 +221,7 @@ public async Task SettingThreeCookiesInOneRequestAppearsInDocument()
{
if (Helper.IsNetworkAvailable())
{
var url = "https://httpbin.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar";
var url = "https://httpbingo.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar";
var config = Configuration.Default.WithCookies().WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(url);
Expand All @@ -236,20 +236,18 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest()
{
if (Helper.IsNetworkAvailable())
{
var baseUrl = "https://httpbin.org/cookies";
var baseUrl = "https://httpbingo.org/cookies";
var url = baseUrl + "/set?test=baz&k2=v2&k1=v1&foo=bar";
var config = Configuration.Default.WithCookies().WithDefaultLoader();
var context = BrowsingContext.New(config);
await context.OpenAsync(url);
var document = await context.OpenAsync(baseUrl);

var expected = @"{
""cookies"": {
""foo"": ""bar"",
""k1"": ""v1"",
""k2"": ""v2"",
""test"": ""baz""
}
""foo"": ""bar"",
""k1"": ""v1"",
""k2"": ""v2"",
""test"": ""baz""
}
".Replace("\r\n", "\n");

Expand All @@ -258,22 +256,19 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest()
}

[Test]
[Ignore("We should find a replacement for HttpBin.org")]
public async Task SettingCookieIsPreservedViaRedirect()
{
if (Helper.IsNetworkAvailable())
{
var cookieUrl = "https://httpbin.org/cookies/set?test=baz";
var redirectUrl = "https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fcookies";
var cookieUrl = "https://httpbingo.org/cookies/set?test=baz";
var redirectUrl = "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fcookies";
var config = Configuration.Default.WithCookies().WithDefaultLoader();
var context = BrowsingContext.New(config);
await context.OpenAsync(cookieUrl);
var document = await context.OpenAsync(redirectUrl);

Assert.AreEqual(@"{
""cookies"": {
""test"": ""baz""
}
""test"": ""baz""
}
".Replace("\r\n", "\n"), document.Body.TextContent);
}
Expand Down
36 changes: 14 additions & 22 deletions src/AngleSharp.Io.Tests/Network/CookieHandlingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task SettingOneCookiesInOneRequestAppearsInDocument()
{
if (Helper.IsNetworkAvailable())
{
var url = "https://httpbin.org/cookies/set?k1=v1";
var url = "https://httpbingo.org/cookies/set?k1=v1";
var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(url);
Expand All @@ -27,7 +27,7 @@ public async Task SettingTwoCookiesInOneRequestAppearsInDocument()
{
if (Helper.IsNetworkAvailable())
{
var url = "https://httpbin.org/cookies/set?k2=v2&k1=v1";
var url = "https://httpbingo.org/cookies/set?k2=v2&k1=v1";
var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(url);
Expand All @@ -41,7 +41,7 @@ public async Task SettingThreeCookiesInOneRequestAppearsInDocument()
{
if (Helper.IsNetworkAvailable())
{
var url = "https://httpbin.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar";
var url = "https://httpbingo.org/cookies/set?test=baz&k2=v2&k1=v1&foo=bar";
var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader();
var context = BrowsingContext.New(config);
var document = await context.OpenAsync(url);
Expand All @@ -55,64 +55,56 @@ public async Task SettingThreeCookiesInOneRequestAreTransportedToNextRequest()
{
if (Helper.IsNetworkAvailable())
{
var baseUrl = "https://httpbin.org/cookies";
var baseUrl = "https://httpbingo.org/cookies";
var url = baseUrl + "/set?test=baz&k2=v2&k1=v1&foo=bar";
var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader();
var context = BrowsingContext.New(config);
await context.OpenAsync(url);
var document = await context.OpenAsync(baseUrl);

Assert.AreEqual(@"{
""cookies"": {
""foo"": ""bar"",
""k1"": ""v1"",
""k2"": ""v2"",
""test"": ""baz""
}
""foo"": ""bar"",
""k1"": ""v1"",
""k2"": ""v2"",
""test"": ""baz""
}
".Replace("\r\n", "\n"), document.Body.TextContent);
}
}

[Test]
[Ignore("We should find a replacement for HttpBin.org")]
public async Task SettingCookieIsPreservedViaRedirect()
{
if (Helper.IsNetworkAvailable())
{
var cookieUrl = "https://httpbin.org/cookies/set?test=baz";
var redirectUrl = "https://httpbin.org/redirect-to?url=https%3A%2F%2Fhttpbin.org%2Fcookies";
var cookieUrl = "https://httpbingo.org/cookies/set?test=baz";
var redirectUrl = "https://httpbingo.org/redirect-to?url=https%3A%2F%2Fhttpbingo.org%2Fcookies";
var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader();
var context = BrowsingContext.New(config);
await context.OpenAsync(cookieUrl);
var document = await context.OpenAsync(redirectUrl);

Assert.AreEqual(@"{
""cookies"": {
""test"": ""baz""
}
""test"": ""baz""
}
".Replace("\r\n", "\n"), document.Body.TextContent);
}
}

[Test]
[Ignore("We should find a replacement for HttpBin.org")]
public async Task SettingCookieIsPreservedViaRedirectToDifferentProtocol()
{
if (Helper.IsNetworkAvailable())
{
var cookieUrl = "https://httpbin.org/cookies/set?test=baz";
var redirectUrl = "http://httpbin.org/redirect-to?url=http%3A%2F%2Fhttpbin.org%2Fcookies";
var cookieUrl = "https://httpbingo.org/cookies/set?test=baz";
var redirectUrl = "http://httpbingo.org/redirect-to?url=http%3A%2F%2Fhttpbingo.org%2Fcookies";
var config = Configuration.Default.WithCookies().WithRequesters().WithDefaultLoader();
var context = BrowsingContext.New(config);
await context.OpenAsync(cookieUrl);
var document = await context.OpenAsync(redirectUrl);

Assert.AreEqual(@"{
""cookies"": {
""test"": ""baz""
}
""test"": ""baz""
}
".Replace("\r\n", "\n"), document.Body.TextContent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public async Task EndToEnd()
var requester = new HttpClientRequester(httpClient);
var configuration = Configuration.Default.With(requester).WithDefaultLoader();
var context = BrowsingContext.New(configuration);
var request = DocumentRequest.Get(Url.Create("http://httpbin.org/html"));
var request = DocumentRequest.Get(Url.Create("http://httpbingo.org/html"));

// ACT
var response = await context.GetService<IDocumentLoader>().FetchAsync(request).Task;
Expand Down

0 comments on commit f11e802

Please sign in to comment.