diff --git a/unirest-mocks/src/main/java/kong/unirest/core/Routes.java b/unirest-mocks/src/main/java/kong/unirest/core/Routes.java index cfd853d9..c03d30ec 100644 --- a/unirest-mocks/src/main/java/kong/unirest/core/Routes.java +++ b/unirest-mocks/src/main/java/kong/unirest/core/Routes.java @@ -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) { diff --git a/unirest-mocks/src/test/java/kong/tests/AssertTest.java b/unirest-mocks/src/test/java/kong/tests/AssertTest.java index c58814d6..b1411c25 100644 --- a/unirest-mocks/src/test/java/kong/tests/AssertTest.java +++ b/unirest-mocks/src/test/java/kong/tests/AssertTest.java @@ -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 body; @Override