Merge branch '1.2.x'
This commit is contained in:
@@ -213,6 +213,20 @@ public class CurlRequestSnippetTests extends AbstractSnippetTests {
|
||||
.method("POST").param("a", "alpha").param("b", "bravo").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postRequestWithOverlappingParametersAndFormUrlEncodedBody()
|
||||
throws IOException {
|
||||
this.snippets.expectCurlRequest().withContents(
|
||||
codeBlock("bash").content("$ curl 'http://localhost/foo' -i -X POST "
|
||||
+ "-H 'Content-Type: application/x-www-form-urlencoded' "
|
||||
+ "-d 'a=alpha&b=bravo'"));
|
||||
new CurlRequestSnippet(this.commandFormatter).document(this.operationBuilder
|
||||
.request("http://localhost/foo").method("POST").content("a=alpha&b=bravo")
|
||||
.header(HttpHeaders.CONTENT_TYPE,
|
||||
MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
.param("a", "alpha").param("b", "bravo").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void putRequestWithOneParameter() throws IOException {
|
||||
this.snippets.expectCurlRequest().withContents(codeBlock("bash")
|
||||
|
||||
@@ -214,6 +214,20 @@ public class HttpieRequestSnippetTests extends AbstractSnippetTests {
|
||||
.method("POST").param("a", "alpha").param("b", "bravo").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postRequestWithOverlappingParametersAndFormUrlEncodedBody()
|
||||
throws IOException {
|
||||
this.snippets.expectHttpieRequest()
|
||||
.withContents(codeBlock("bash").content(
|
||||
"$ echo 'a=alpha&b=bravo' | http POST 'http://localhost/foo' "
|
||||
+ "'Content-Type:application/x-www-form-urlencoded'"));
|
||||
new HttpieRequestSnippet(this.commandFormatter).document(this.operationBuilder
|
||||
.request("http://localhost/foo").method("POST").content("a=alpha&b=bravo")
|
||||
.header(HttpHeaders.CONTENT_TYPE,
|
||||
MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
.param("a", "alpha").param("b", "bravo").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void putRequestWithOneParameter() throws IOException {
|
||||
this.snippets.expectHttpieRequest().withContents(codeBlock("bash")
|
||||
|
||||
@@ -202,6 +202,23 @@ public class HttpRequestSnippetTests extends AbstractSnippetTests {
|
||||
.param("a", "alpha").param("b", "bravo").content(content).build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postRequestWithOverlappingParametersAndFormUrlEncodedBody()
|
||||
throws IOException {
|
||||
String content = "a=alpha&b=bravo";
|
||||
this.snippets.expectHttpRequest()
|
||||
.withContents(httpRequest(RequestMethod.POST, "/foo")
|
||||
.header(HttpHeaders.CONTENT_TYPE,
|
||||
MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
.header(HttpHeaders.HOST, "localhost").content(content)
|
||||
.header(HttpHeaders.CONTENT_LENGTH, content.getBytes().length));
|
||||
new HttpRequestSnippet().document(this.operationBuilder
|
||||
.request("http://localhost/foo").method("POST").content("a=alpha&b=bravo")
|
||||
.header(HttpHeaders.CONTENT_TYPE,
|
||||
MediaType.APPLICATION_FORM_URLENCODED_VALUE)
|
||||
.param("a", "alpha").param("b", "bravo").build());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postRequestWithCharset() throws IOException {
|
||||
String japaneseContent = "\u30b3\u30f3\u30c6\u30f3\u30c4";
|
||||
|
||||
Reference in New Issue
Block a user