mirror of
https://github.com/Kong/insomnia
synced 2024-11-07 22:30:15 +00:00
Add response preview for audio payloads (#467)
* Add response preview for audio payloads * Fix linter issue
This commit is contained in:
parent
94119f6b68
commit
4afb7bc55c
@ -182,6 +182,16 @@ class ResponseViewer extends PureComponent {
|
|||||||
<SimplePDF file={`data:${justContentType};base64,${base64Body}`}/>
|
<SimplePDF file={`data:${justContentType};base64,${base64Body}`}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
} else if (previewMode === PREVIEW_MODE_FRIENDLY && ct.indexOf('audio/') === 0) {
|
||||||
|
const justContentType = contentType.split(';')[0];
|
||||||
|
const base64Body = bodyBuffer.toString('base64');
|
||||||
|
return (
|
||||||
|
<div className="vertically-center">
|
||||||
|
<audio controls>
|
||||||
|
<source src={`data:${justContentType};base64,${base64Body}`} />
|
||||||
|
</audio>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
} else if (previewMode === PREVIEW_MODE_RAW) {
|
} else if (previewMode === PREVIEW_MODE_RAW) {
|
||||||
const match = contentType.match(/charset=([\w-]+)/);
|
const match = contentType.match(/charset=([\w-]+)/);
|
||||||
const charset = (match && match.length >= 2) ? match[1] : 'utf-8';
|
const charset = (match && match.length >= 2) ? match[1] : 'utf-8';
|
||||||
|
Loading…
Reference in New Issue
Block a user