Line breaks in cURL and HTTPie snippets
Closes gh-260
This commit is contained in:
committed by
Andy Wilkinson
parent
82164348f3
commit
2cb9d36ef1
@@ -162,8 +162,8 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-content/curl-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content("$ curl " + "'http://localhost:8080/' -i -X POST "
|
||||
+ "-H 'Accept: application/json' -d 'content'"))));
|
||||
.content(String.format("$ curl " + "'http://localhost:8080/' -i -X POST "
|
||||
+ "\\%n -H 'Accept: application/json' \\%n -d 'content'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -178,8 +178,8 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-cookies/curl-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content("$ curl " + "'http://localhost:8080/' -i "
|
||||
+ "-H 'Accept: application/json' --cookie 'cookieName=cookieVal'"))));
|
||||
.content(String.format("$ curl " + "'http://localhost:8080/' -i "
|
||||
+ "\\%n -H 'Accept: application/json' \\%n --cookie 'cookieName=cookieVal'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -193,9 +193,9 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-query-string/curl-request.adoc"),
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content("$ curl "
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content(String.format("$ curl "
|
||||
+ "'http://localhost:8080/?foo=bar' -i -X POST "
|
||||
+ "-H 'Accept: application/json' -d 'a=alpha'"))));
|
||||
+ "\\%n -H 'Accept: application/json' \\%n -d 'a=alpha'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -209,9 +209,9 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/curl-snippet-with-content-and-parameters/curl-request.adoc"),
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content("$ curl "
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content(String.format("$ curl "
|
||||
+ "'http://localhost:8080/?a=alpha' -i -X POST "
|
||||
+ "-H 'Accept: application/json' -d 'some content'"))));
|
||||
+ "\\%n -H 'Accept: application/json' \\%n -d 'some content'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -226,8 +226,8 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/httpie-snippet-with-content/httpie-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content("$ echo 'content' | http POST 'http://localhost:8080/'"
|
||||
+ " 'Accept:application/json'"))));
|
||||
.content(String.format("$ echo 'content' | http POST 'http://localhost:8080/'"
|
||||
+ " \\%n 'Accept:application/json'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -242,8 +242,8 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/httpie-snippet-with-cookies/httpie-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content("$ http GET 'http://localhost:8080/'"
|
||||
+ " 'Accept:application/json' 'Cookie:cookieName=cookieVal'"))));
|
||||
.content(String.format("$ http GET 'http://localhost:8080/'"
|
||||
+ " \\%n 'Accept:application/json' \\%n 'Cookie:cookieName=cookieVal'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -257,9 +257,9 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/httpie-snippet-with-query-string/httpie-request.adoc"),
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content("$ http "
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content(String.format("$ http "
|
||||
+ "--form POST 'http://localhost:8080/?foo=bar' "
|
||||
+ "'Accept:application/json' 'a=alpha'"))));
|
||||
+ "\\%n 'Accept:application/json' \\%n 'a=alpha'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -273,9 +273,9 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/httpie-snippet-post-with-content-and-parameters/httpie-request.adoc"),
|
||||
is(snippet(asciidoctor()).withContents(codeBlock(asciidoctor(), "bash")
|
||||
.content("$ echo " + "'some content' | http POST "
|
||||
.content(String.format("$ echo " + "'some content' | http POST "
|
||||
+ "'http://localhost:8080/?a=alpha' "
|
||||
+ "'Accept:application/json'"))));
|
||||
+ "\\%n 'Accept:application/json'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -560,8 +560,8 @@ public class MockMvcRestDocumentationIntegrationTests {
|
||||
new File(
|
||||
"build/generated-snippets/custom-context-path/curl-request.adoc"),
|
||||
is(snippet(asciidoctor())
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content(
|
||||
"$ curl 'http://localhost:8080/custom/' -i -H 'Accept: application/json'"))));
|
||||
.withContents(codeBlock(asciidoctor(), "bash").content(String.format(
|
||||
"$ curl 'http://localhost:8080/custom/' -i \\%n -H 'Accept: application/json'")))));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user