Skip to content

Commit 275d96a

Browse files
committed
Fixes #259 Request body Examples JSON should be stringified
1 parent da8ced5 commit 275d96a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/api-request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,14 +412,14 @@ export default class ApiRequest extends LitElement {
412412
spellcheck = "false"
413413
data-ptype = "${reqBody.mimeType}"
414414
style="width:100%; resize:vertical;"
415-
>${v.exampleValue}</textarea>
415+
>${(v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2))}</textarea>
416416
<!-- This textarea(hidden) is to store the original example value, this will remain unchanged when users switches from one example to another, its is used to populate the editable textarea -->
417417
<textarea
418418
class = "textarea request-body-param ${reqBody.mimeType.substring(reqBody.mimeType.indexOf('/') + 1)}"
419419
spellcheck = "false"
420420
data-ptype = "${reqBody.mimeType}"
421421
style="width:100%; resize:vertical; display:none"
422-
>${v.exampleValue}</textarea>
422+
>${(v.exampleFormat === 'text' ? v.exampleValue : JSON.stringify(v.exampleValue, null, 2))}</textarea>
423423
</div>
424424
`)}
425425

0 commit comments

Comments
 (0)