Skip to content

Out: fix escaping of curl commands #360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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