Fix HTTP request snippet's handling of query strings and params

Closes gh-763
This commit is contained in:
Andy Wilkinson
2022-01-10 14:31:03 +00:00
parent 90e0721b7a
commit d4d83f293a
2 changed files with 11 additions and 2 deletions

View File

@@ -224,6 +224,14 @@ public class HttpRequestSnippetTests extends AbstractSnippetTests {
.header("Content-Type", "application/x-www-form-urlencoded").content("b%26r=baz&a=alpha"));
}
@Test
public void putRequestWithTotallyOverlappingQueryStringAndParameters() throws IOException {
new HttpRequestSnippet().document(this.operationBuilder.request("http://localhost/foo?a=alpha&b=bravo")
.method("PUT").param("a", "alpha").param("b", "bravo").build());
assertThat(this.generatedSnippets.httpRequest())
.is(httpRequest(RequestMethod.PUT, "/foo?a=alpha&b=bravo").header(HttpHeaders.HOST, "localhost"));
}
@Test
public void multipartPost() throws IOException {
new HttpRequestSnippet().document(this.operationBuilder.request("http://localhost/upload").method("POST")