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({
672
672
contentType = contentType . split ( ';' ) [ 0 ] . trim ( ) ;
673
673
}
674
674
}
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
+ }
675
686
$ ( '.response_body' , $ ( this . el ) ) . removeClass ( 'json' ) ;
676
687
$ ( '.response_body' , $ ( this . el ) ) . removeClass ( 'xml' ) ;
677
688
@@ -687,7 +698,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
687
698
pre = $ ( '<pre class="json" />' ) . append ( code ) ;
688
699
689
700
// 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' ] ) ||
691
704
headers [ 'content-disposition' ] && ( / a t t a c h m e n t / ) . test ( headers [ 'content-disposition' ] ) ||
692
705
headers [ 'Content-Description' ] && ( / F i l e T r a n s f e r / ) . test ( headers [ 'Content-Description' ] ) ||
693
706
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