OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
API
/
swagger-ui-5.17.14
/
src
/
core
/
components
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
08/07/2024 04:34:11 AM
rwxr-xr-x
📄
app.jsx
621 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📁
auth
-
08/07/2024 04:34:04 AM
rwxr-xr-x
📄
clear.jsx
599 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
contact.jsx
1.14 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
content-type.jsx
1.71 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
copy-to-clipboard-btn.jsx
740 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
curl.jsx
1.11 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
debug.jsx
1.05 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
deep-link.jsx
475 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
errors.jsx
4.03 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
example.jsx
1.14 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
examples-select-value-retainer.jsx
8.08 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
examples-select.jsx
3.9 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
execute.jsx
3.4 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
footer.jsx
156 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
headers.jsx
1.81 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
info.jsx
3.99 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
initialized-input.jsx
1.43 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
jump-to-path.jsx
191 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
layout-utils.jsx
5.37 KB
08/07/2024 04:33:53 AM
rw-r--r--
📁
layouts
-
08/07/2024 04:34:05 AM
rwxr-xr-x
📄
license.jsx
1.01 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
live-response.jsx
4.67 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
online-validator-badge.jsx
3.15 KB
08/07/2024 04:33:53 AM
rw-r--r--
📄
openapi-version.jsx
314 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
operation-extension-row.jsx
411 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
operation-extensions.jsx
970 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
operation-summary-method.jsx
535 bytes
08/07/2024 04:33:53 AM
rw-r--r--
📄
operation-summary-path.jsx
1.38 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
operation-summary.jsx
3.57 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
operation-tag.jsx
3.63 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
operation.jsx
9.93 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
operations.jsx
2.8 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
overview.jsx
3.57 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
param-body.jsx
4.85 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
parameter-extension.jsx
302 bytes
08/07/2024 04:33:54 AM
rw-r--r--
📄
parameter-include-empty.jsx
1.43 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
parameter-row.jsx
14.28 KB
08/07/2024 04:33:54 AM
rw-r--r--
📁
parameters
-
08/07/2024 04:34:05 AM
rwxr-xr-x
📄
property.jsx
376 bytes
08/07/2024 04:33:54 AM
rw-r--r--
📁
providers
-
08/07/2024 04:34:05 AM
rwxr-xr-x
📄
response-body.jsx
5.97 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
response-extension.jsx
316 bytes
08/07/2024 04:33:54 AM
rw-r--r--
📄
response.jsx
9.31 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
responses.jsx
6.59 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
svg-assets.jsx
3.15 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
system-wrapper.jsx
0 bytes
08/07/2024 04:33:54 AM
rw-r--r--
📄
try-it-out-button.jsx
1.36 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
version-pragma-filter.jsx
1.84 KB
08/07/2024 04:33:54 AM
rw-r--r--
📄
version-stamp.jsx
271 bytes
08/07/2024 04:33:54 AM
rw-r--r--
Editing: response-body.jsx
Close
import React from "react" import PropTypes from "prop-types" import formatXml from "xml-but-prettier" import toLower from "lodash/toLower" import { extractFileNameFromContentDispositionHeader } from "core/utils" import { getKnownSyntaxHighlighterLanguage } from "core/utils/jsonParse" import win from "core/window" export default class ResponseBody extends React.PureComponent { state = { parsedContent: null } static propTypes = { content: PropTypes.any.isRequired, contentType: PropTypes.string, getComponent: PropTypes.func.isRequired, headers: PropTypes.object, url: PropTypes.string } updateParsedContent = (prevContent) => { const { content } = this.props if(prevContent === content) { return } if(content && content instanceof Blob) { var reader = new FileReader() reader.onload = () => { this.setState({ parsedContent: reader.result }) } reader.readAsText(content) } else { this.setState({ parsedContent: content.toString() }) } } componentDidMount() { this.updateParsedContent(null) } componentDidUpdate(prevProps) { this.updateParsedContent(prevProps.content) } render() { let { content, contentType, url, headers={}, getComponent } = this.props const { parsedContent } = this.state const HighlightCode = getComponent("HighlightCode", true) const downloadName = "response_" + new Date().getTime() let body, bodyEl url = url || "" if ( (/^application\/octet-stream/i.test(contentType) || (headers["Content-Disposition"] && /attachment/i.test(headers["Content-Disposition"])) || (headers["content-disposition"] && /attachment/i.test(headers["content-disposition"])) || (headers["Content-Description"] && /File Transfer/i.test(headers["Content-Description"])) || (headers["content-description"] && /File Transfer/i.test(headers["content-description"]))) && (content.size > 0 || content.length > 0) ) { // Download if ("Blob" in window) { let type = contentType || "text/html" let blob = (content instanceof Blob) ? content : new Blob([content], {type: type}) let href = window.URL.createObjectURL(blob) let fileName = url.substr(url.lastIndexOf("/") + 1) let download = [type, fileName, href].join(":") // Use filename from response header, // First check if filename is quoted (e.g. contains space), if no, fallback to not quoted check let disposition = headers["content-disposition"] || headers["Content-Disposition"] if (typeof disposition !== "undefined") { let responseFilename = extractFileNameFromContentDispositionHeader(disposition) if (responseFilename !== null) { download = responseFilename } } if(win.navigator && win.navigator.msSaveOrOpenBlob) { bodyEl = <div><a href={ href } onClick={() => win.navigator.msSaveOrOpenBlob(blob, download)}>{ "Download file" }</a></div> } else { bodyEl = <div><a href={ href } download={ download }>{ "Download file" }</a></div> } } else { bodyEl = <pre className="microlight">Download headers detected but your browser does not support downloading binary via XHR (Blob).</pre> } // Anything else (CORS) } else if (/json/i.test(contentType)) { // JSON let language = null let testValueForJson = getKnownSyntaxHighlighterLanguage(content) if (testValueForJson) { language = "json" } try { body = JSON.stringify(JSON.parse(content), null, " ") } catch (error) { body = "can't parse JSON. Raw result:\n\n" + content } bodyEl = <HighlightCode language={language} downloadable fileName={`${downloadName}.json`} canCopy>{body}</HighlightCode> // XML } else if (/xml/i.test(contentType)) { body = formatXml(content, { textNodesOnSameLine: true, indentor: " " }) bodyEl = <HighlightCode downloadable fileName={`${downloadName}.xml`} canCopy>{body}</HighlightCode> // HTML or Plain Text } else if (toLower(contentType) === "text/html" || /text\/plain/.test(contentType)) { bodyEl = <HighlightCode downloadable fileName={`${downloadName}.html`} canCopy>{content}</HighlightCode> // CSV } else if (toLower(contentType) === "text/csv" || /text\/csv/.test(contentType)) { bodyEl = <HighlightCode downloadable fileName={`${downloadName}.csv`} canCopy>{content}</HighlightCode> // Image } else if (/^image\//i.test(contentType)) { if(contentType.includes("svg")) { bodyEl = <div> { content } </div> } else { bodyEl = <img src={ window.URL.createObjectURL(content) } /> } // Audio } else if (/^audio\//i.test(contentType)) { bodyEl = <pre className="microlight"><audio controls key={ url }><source src={ url } type={ contentType } /></audio></pre> } else if (typeof content === "string") { bodyEl = <HighlightCode downloadable fileName={`${downloadName}.txt`} canCopy>{content}</HighlightCode> } else if ( content.size > 0 ) { // We don't know the contentType, but there was some content returned if(parsedContent) { // We were able to squeeze something out of content // in `updateParsedContent`, so let's display it bodyEl = <div> <p className="i"> Unrecognized response type; displaying content as text. </p> <HighlightCode downloadable fileName={`${downloadName}.txt`} canCopy>{parsedContent}</HighlightCode> </div> } else { // Give up bodyEl = <p className="i"> Unrecognized response type; unable to display. </p> } } else { // We don't know the contentType and there was no content returned bodyEl = null } return ( !bodyEl ? null : <div> <h5>Response body</h5> { bodyEl } </div> ) } }