File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -672,6 +672,17 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
672672 contentType = contentType . split ( ';' ) [ 0 ] . trim ( ) ;
673673 }
674674 }
675+ if ( contentType ) {
676+ if ( typeof content === 'string' ) {
677+ var arrayBuffer = new ArrayBuffer ( content . length ) ;
678+ var uint8Array = new Uint8Array ( arrayBuffer ) ;
679+ for ( var i = 0 ; i < content . length ; i ++ ) {
680+ uint8Array [ i ] = content . charCodeAt ( i ) ;
681+ }
682+
683+ content = new Blob ( [ uint8Array ] , { type : contentType } ) ;
684+ }
685+ }
675686 $ ( '.response_body' , $ ( this . el ) ) . removeClass ( 'json' ) ;
676687 $ ( '.response_body' , $ ( this . el ) ) . removeClass ( 'xml' ) ;
677688
@@ -687,7 +698,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
687698 pre = $ ( '<pre class="json" />' ) . append ( code ) ;
688699
689700 // JSON
690- } else if ( headers [ 'Content-Disposition' ] && ( / a t t a c h m e n t / ) . test ( headers [ 'Content-Disposition' ] ) ||
701+ } else if (
702+ contentType === 'application/octet-stream' ||
703+ headers [ 'Content-Disposition' ] && ( / a t t a c h m e n t / ) . test ( headers [ 'Content-Disposition' ] ) ||
691704 headers [ 'content-disposition' ] && ( / a t t a c h m e n t / ) . test ( headers [ 'content-disposition' ] ) ||
692705 headers [ 'Content-Description' ] && ( / F i l e T r a n s f e r / ) . test ( headers [ 'Content-Description' ] ) ||
693706 headers [ 'content-description' ] && ( / F i l e T r a n s f e r / ) . test ( headers [ 'content-description' ] ) ) {
You can’t perform that action at this time.
0 commit comments