Skip to content

Commit

Permalink
Out: fix escaping of curl commands
Browse files Browse the repository at this point in the history
Issue GH-359
  • Loading branch information
SMillerDev committed Jun 6, 2022
1 parent 20f9731 commit 2987fc6
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 115 deletions.
2 changes: 1 addition & 1 deletion src/PHPDraft/Out/HTML/default/transition.twig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
data-placement="left"
data-toggle="popover"
data-html="true"
data-content="<textarea rows='8' cols='75'>{{ transition.get_curl_command(data.HOST)|raw }}</textarea>">
data-content="<textarea rows='8' cols='75'>{{ transition.get_curl_command(data.HOST) }}</textarea>">
<span class="fas fa-copy"></span>
</a>
<h5>Example URI</h5>
Expand Down
2 changes: 1 addition & 1 deletion src/PHPDraft/Out/HTML/material/transition.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div id="modal-{{ request.get_id }}" class="modal">
<div class="modal-content">
<label> Example cURL request:
<textarea rows='75' cols='75'>{{ transition.get_curl_command(data.HOST)|raw }}</textarea>
<textarea rows='75' cols='75'>{{ transition.get_curl_command(data.HOST) }}</textarea>
</label>
</div>
<div class="modal-footer">
Expand Down
2 changes: 2 additions & 0 deletions tests/statics/drafter/apib/index.apib
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ You must provide the `Authorization: Bearer {access_token}` header in all other

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

+ Request (application/json)

+ Attributes
+ grant_type: `password` (string) - The type of oAuth grant. Always "password"
+ client_id: `abc` (string) - The oAuth client ID
Expand Down
78 changes: 50 additions & 28 deletions tests/statics/drafter/html/basic.html

Large diffs are not rendered by default.

78 changes: 50 additions & 28 deletions tests/statics/drafter/html/basic_old.html

Large diffs are not rendered by default.

79 changes: 51 additions & 28 deletions tests/statics/drafter/html/material.html

Large diffs are not rendered by default.

79 changes: 51 additions & 28 deletions tests/statics/drafter/html/material_old.html

Large diffs are not rendered by default.

63 changes: 62 additions & 1 deletion tests/statics/drafter/json/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,70 @@
"method": {
"element": "string",
"content": "POST"
},
"headers": {
"element": "httpHeaders",
"content": [
{
"element": "member",
"content": {
"key": {
"element": "string",
"content": "Content-Type"
},
"value": {
"element": "string",
"content": "application/json"
}
}
}
]
}
},
"content": []
"content": [
{
"element": "asset",
"meta": {
"classes": {
"element": "array",
"content": [
{
"element": "string",
"content": "messageBody"
}
]
}
},
"attributes": {
"contentType": {
"element": "string",
"content": "application/json"
}
},
"content": "{\n \"grant_type\": \"password\",\n \"client_id\": \"abc\",\n \"client_secret\": \"123\",\n \"email\": \"[email protected]\",\n \"password\": \"edisonsux\"\n}"
},
{
"element": "asset",
"meta": {
"classes": {
"element": "array",
"content": [
{
"element": "string",
"content": "messageBodySchema"
}
]
}
},
"attributes": {
"contentType": {
"element": "string",
"content": "application/schema+json"
}
},
"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}"
}
]
},
{
"element": "httpResponse",
Expand Down

0 comments on commit 2987fc6

Please sign in to comment.