Merge branch '1.2.x'

This commit is contained in:
Andy Wilkinson
2017-09-23 17:40:29 +01:00
2 changed files with 28 additions and 7 deletions

View File

@@ -285,6 +285,23 @@ public class HttpRequestSnippetTests extends AbstractSnippetTests {
.part("image", "<< data >>".getBytes()).build());
}
@Test
public void multipartPostWithFilename() throws IOException {
String expectedContent = createPart(String.format("Content-Disposition: "
+ "form-data; " + "name=image; filename=image.png%n%n<< data >>"));
this.snippets.expectHttpRequest()
.withContents(httpRequest(RequestMethod.POST, "/upload")
.header("Content-Type",
"multipart/form-data; boundary=" + BOUNDARY)
.header(HttpHeaders.HOST, "localhost").content(expectedContent));
new HttpRequestSnippet().document(
this.operationBuilder.request("http://localhost/upload").method("POST")
.header(HttpHeaders.CONTENT_TYPE,
MediaType.MULTIPART_FORM_DATA_VALUE)
.part("image", "<< data >>".getBytes()).submittedFileName("image.png")
.build());
}
@Test
public void multipartPostWithParameters() throws IOException {
String param1Part = createPart(