Skip to content

Commit 2987fc6

Browse files
committed
Out: fix escaping of curl commands
Issue GH-359
1 parent 20f9731 commit 2987fc6

File tree

8 files changed

+268
-115
lines changed

8 files changed

+268
-115
lines changed

src/PHPDraft/Out/HTML/default/transition.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
data-placement="left"
3636
data-toggle="popover"
3737
data-html="true"
38-
data-content="<textarea rows='8' cols='75'>{{ transition.get_curl_command(data.HOST)|raw }}</textarea>">
38+
data-content="<textarea rows='8' cols='75'>{{ transition.get_curl_command(data.HOST) }}</textarea>">
3939
<span class="fas fa-copy"></span>
4040
</a>
4141
<h5>Example URI</h5>

src/PHPDraft/Out/HTML/material/transition.twig

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<div id="modal-{{ request.get_id }}" class="modal">
3131
<div class="modal-content">
3232
<label> Example cURL request:
33-
<textarea rows='75' cols='75'>{{ transition.get_curl_command(data.HOST)|raw }}</textarea>
33+
<textarea rows='75' cols='75'>{{ transition.get_curl_command(data.HOST) }}</textarea>
3434
</label>
3535
</div>
3636
<div class="modal-footer">

tests/statics/drafter/apib/index.apib

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ You must provide the `Authorization: Bearer {access_token}` header in all other
1919

2020
The current client ID and secret are [available here](http://pastebin.com/fX6ejAHd)
2121

22+
+ Request (application/json)
23+
2224
+ Attributes
2325
+ grant_type: `password` (string) - The type of oAuth grant. Always "password"
2426
+ client_id: `abc` (string) - The oAuth client ID

tests/statics/drafter/html/basic.html

+50-28
Large diffs are not rendered by default.

tests/statics/drafter/html/basic_old.html

+50-28
Large diffs are not rendered by default.

tests/statics/drafter/html/material.html

+51-28
Large diffs are not rendered by default.

tests/statics/drafter/html/material_old.html

+51-28
Large diffs are not rendered by default.

tests/statics/drafter/json/index.json

+62-1
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,70 @@
286286
"method": {
287287
"element": "string",
288288
"content": "POST"
289+
},
290+
"headers": {
291+
"element": "httpHeaders",
292+
"content": [
293+
{
294+
"element": "member",
295+
"content": {
296+
"key": {
297+
"element": "string",
298+
"content": "Content-Type"
299+
},
300+
"value": {
301+
"element": "string",
302+
"content": "application/json"
303+
}
304+
}
305+
}
306+
]
289307
}
290308
},
291-
"content": []
309+
"content": [
310+
{
311+
"element": "asset",
312+
"meta": {
313+
"classes": {
314+
"element": "array",
315+
"content": [
316+
{
317+
"element": "string",
318+
"content": "messageBody"
319+
}
320+
]
321+
}
322+
},
323+
"attributes": {
324+
"contentType": {
325+
"element": "string",
326+
"content": "application/json"
327+
}
328+
},
329+
"content": "{\n \"grant_type\": \"password\",\n \"client_id\": \"abc\",\n \"client_secret\": \"123\",\n \"email\": \"[email protected]\",\n \"password\": \"edisonsux\"\n}"
330+
},
331+
{
332+
"element": "asset",
333+
"meta": {
334+
"classes": {
335+
"element": "array",
336+
"content": [
337+
{
338+
"element": "string",
339+
"content": "messageBodySchema"
340+
}
341+
]
342+
}
343+
},
344+
"attributes": {
345+
"contentType": {
346+
"element": "string",
347+
"content": "application/schema+json"
348+
}
349+
},
350+
"content": "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"type\": \"object\",\n \"properties\": {\n \"grant_type\": {\n \"type\": \"string\"\n },\n \"client_id\": {\n \"type\": \"string\"\n },\n \"client_secret\": {\n \"type\": \"string\"\n },\n \"email\": {\n \"type\": \"string\"\n },\n \"password\": {\n \"type\": \"string\"\n }\n }\n}"
351+
}
352+
]
292353
},
293354
{
294355
"element": "httpResponse",

0 commit comments

Comments
 (0)