File tree Expand file tree Collapse file tree 3 files changed +23
-0
lines changed
Expand file tree Collapse file tree 3 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ module.exports = function (source, options) {
4040 code . push ( opts . short ? '-0' : '--http1.0' )
4141 }
4242
43+ if ( headerHelpers . getHeader ( source . allHeaders , 'accept-encoding' ) ) {
44+ code . push ( '--compressed' )
45+ }
46+
4347 // if multipart form data, we want to remove the boundary
4448 if ( source . postData . mimeType === 'multipart/form-data' ) {
4549 const contentTypeHeaderName = headerHelpers . getHeaderName ( source . headersObj , 'content-type' )
Original file line number Diff line number Diff line change 1+ {
2+ "method" : " GET" ,
3+ "url" : " http://mockbin.com/har" ,
4+ "headers" : [
5+ {
6+ "name" : " accept-encoding" ,
7+ "value" : " deflate, gzip, br"
8+ }
9+ ]
10+ }
Original file line number Diff line number Diff line change @@ -64,6 +64,15 @@ module.exports = function (HTTPSnippet, fixtures) {
6464 result . should . eql ( 'curl --request GET --url http://mockbin.com/request --http1.0' )
6565 } )
6666
67+ it ( 'should use --compressed for requests that accept encodings' , function ( ) {
68+ const result = new HTTPSnippet ( fixtures . curl . compression ) . convert ( 'shell' , 'curl' , {
69+ indent : false
70+ } )
71+
72+ result . should . be . a . String ( )
73+ result . should . eql ( "curl --request GET --url http://mockbin.com/har --compressed --header 'accept-encoding: deflate, gzip, br'" )
74+ } )
75+
6776 it ( 'should use custom indentation' , function ( ) {
6877 const result = new HTTPSnippet ( fixtures . requests . full ) . convert ( 'shell' , 'curl' , {
6978 indent : '@'
You can’t perform that action at this time.
0 commit comments