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 @@ -44,6 +44,10 @@ module.exports = function (source, options) {
4444 code . push ( opts . short ? '-0' : '--http1.0' )
4545 }
4646
47+ if ( headerHelpers . getHeader ( source . allHeaders , 'accept-encoding' ) ) {
48+ code . push ( '--compressed' )
49+ }
50+
4751 // if multipart form data, we want to remove the boundary
4852 if ( source . postData . mimeType === 'multipart/form-data' ) {
4953 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 @@ -74,6 +74,15 @@ module.exports = function (HTTPSnippet, fixtures) {
7474 result . should . eql ( 'curl --request GET --url http://mockbin.com/request --http1.0' )
7575 } )
7676
77+ it ( 'should use --compressed for requests that accept encodings' , function ( ) {
78+ const result = new HTTPSnippet ( fixtures . curl . compression ) . convert ( 'shell' , 'curl' , {
79+ indent : false
80+ } )
81+
82+ result . should . be . a . String ( )
83+ result . should . eql ( "curl --request GET --url http://mockbin.com/har --compressed --header 'accept-encoding: deflate, gzip, br'" )
84+ } )
85+
7786 it ( 'should use custom indentation' , function ( ) {
7887 const result = new HTTPSnippet ( fixtures . requests . full ) . convert ( 'shell' , 'curl' , {
7988 indent : '@'
You can’t perform that action at this time.
0 commit comments