File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -61,14 +61,14 @@ const render = ({ response, flags }) => {
6161 const { headers, timings, requestUrl : uri , body } = response
6262 if ( ! flags . pretty ) return console . log ( body . toString ( ) )
6363
64- const contentType = headers [ 'content-type' ] . toLowerCase ( )
64+ const contentType = headers [ 'content-type' ] . split ( ';' ) [ 0 ] . toLowerCase ( )
6565 const time = prettyMs ( timings . phases . total )
6666 const serverTiming = headers [ 'server-timing' ]
6767 const id = headers [ 'x-request-id' ]
6868
6969 const printMode = ( ( ) => {
7070 if ( body . toString ( ) . startsWith ( 'data:' ) ) return 'base64'
71- if ( ! contentType . includes ( 'utf' ) ) return 'image'
71+ if ( contentType !== 'application/json' ) return 'image'
7272 } ) ( )
7373
7474 switch ( printMode ) {
@@ -84,8 +84,8 @@ const render = ({ response, flags }) => {
8484 console . log ( )
8585 break
8686 default : {
87- const isText = contentType . includes ( 'text/plain' )
88- const isHtml = contentType . includes ( 'text/html' )
87+ const isText = contentType === 'text/plain'
88+ const isHtml = contentType === 'text/html'
8989 const output = isText || isHtml ? body . toString ( ) : JSON . parse ( body )
9090 print . json ( output , flags )
9191 break
You can’t perform that action at this time.
0 commit comments