@@ -12,6 +12,7 @@ export default class ResponseBody extends React.PureComponent {
12
12
}
13
13
14
14
static propTypes = {
15
+ method : PropTypes . string ,
15
16
content : PropTypes . any . isRequired ,
16
17
contentType : PropTypes . string ,
17
18
getComponent : PropTypes . func . isRequired ,
@@ -50,7 +51,7 @@ export default class ResponseBody extends React.PureComponent {
50
51
}
51
52
52
53
render ( ) {
53
- let { content, contentType, url, headers= { } , getComponent } = this . props
54
+ let { method , content, contentType, url, headers= { } , getComponent } = this . props
54
55
const { parsedContent } = this . state
55
56
const HighlightCode = getComponent ( "HighlightCode" , true )
56
57
const downloadName = "response_" + new Date ( ) . getTime ( )
@@ -135,6 +136,9 @@ export default class ResponseBody extends React.PureComponent {
135
136
136
137
// Audio
137
138
} else if ( / ^ a u d i o \/ / i. test ( contentType ) ) {
139
+ if ( method !== "get" ) {
140
+ url = window . URL . createObjectURL ( content )
141
+ }
138
142
bodyEl = < pre className = "microlight" > < audio controls key = { url } > < source src = { url } type = { contentType } /> </ audio > </ pre >
139
143
} else if ( typeof content === "string" ) {
140
144
bodyEl = < HighlightCode downloadable fileName = { `${ downloadName } .txt` } canCopy > { content } </ HighlightCode >
0 commit comments