Skip to content

Commit

Permalink
render svg response as <img>
Browse files Browse the repository at this point in the history
  • Loading branch information
chris48s committed Dec 10, 2022
1 parent 8275317 commit b9a7fa8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/shields-theme/Response.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ function Response() {

return (
<FloatingButton onClick={() => dispatch(clearResponse())} label="Clear">
{ response.startsWith("<svg ")
&&
<img src={`data:image/svg+xml;utf8,${encodeURIComponent(response)}`} />
||
<pre
style={{
background: "var(--openapi-card-background-color)",
Expand All @@ -52,6 +56,7 @@ function Response() {
>
<code>{prettyResponse || "No Response"}</code>
</pre>
}
</FloatingButton>
);
}
Expand Down

0 comments on commit b9a7fa8

Please sign in to comment.