Skip to content

Commit

Permalink
Fix matching of encoded URL paths
Browse files Browse the repository at this point in the history
  • Loading branch information
richardszalay committed Oct 12, 2023
1 parent 404ab79 commit a612fc1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions RichardSzalay.MockHttp.Tests/Issues/Issue116Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Net;
using System.Net.Http;
using System.Threading.Tasks;
using Xunit;

namespace RichardSzalay.MockHttp.Tests.Issues;

public class Issue116Tests
{
// https://github.com/richardszalay/mockhttp/issues/116
[Fact]
public async Task Can_simulate_timeout()
{
var handler = new MockHttpMessageHandler();

handler.When("/topics/$aws%2Fthings%2Ftest-host%2Fshadow%2Fname%2Ftest-shadow%2Fupdate")
.Respond(HttpStatusCode.OK);

var client = new HttpClient(handler);

var result = await client.GetAsync("http://localhost/topics/$aws%2Fthings%2Ftest-host%2Fshadow%2Fname%2Ftest-shadow%2Fupdate");
}
}
2 changes: 1 addition & 1 deletion RichardSzalay.MockHttp/Matchers/UrlMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private string GetUrlToMatch(Uri input)

string source = matchingFullUrl
? new UriBuilder(input) { Query = "" }.Uri.AbsoluteUri
: input.LocalPath;
: input.AbsolutePath;

return source;
}
Expand Down

0 comments on commit a612fc1

Please sign in to comment.