Skip to content

Commit

Permalink
invocation matching not taking verb into account correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ryber committed Oct 26, 2023
1 parent f14c353 commit 85861ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion unirest-mocks/src/main/java/kong/unirest/core/Routes.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Expectation newExpectation() {
boolean matches(HttpRequest request) {
Path p = new Path(request.getUrl());
return this.method.equals(request.getHttpMethod())
&& this.path == null || this.path.equalsIgnoreCase(p.baseUrl());
&& (this.path == null || this.path.equalsIgnoreCase(p.baseUrl()));
}

RawResponse exchange(HttpRequest request, Config config) {
Expand Down
6 changes: 6 additions & 0 deletions unirest-mocks/src/test/java/kong/tests/AssertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ void returnAMockResponseObjectWithoutStuff() {
assertEquals(List.of(), response.getHeaders().get("cool"));
}

@Test
void verbsAreImportant() {
client.expect(GET, path).thenReturn("hi");
assertNotEquals("hi", Unirest.post(path).asString().getBody());
}

private static class BodyBuddy implements Supplier<String>{
String body;
@Override
Expand Down

0 comments on commit 85861ff

Please sign in to comment.