@@ -13,7 +13,7 @@ var _ = require('./lodash'),
1313 * @param {boolean } trim - trim body option
1414 * @returns {String } request body in the desired format
1515 */
16- function parseRawBody ( body , mode , trim ) {
16+ function parseRawBody ( body , mode , trim ) {
1717 var bodySnippet ;
1818 bodySnippet = `let postData = ref ${ sanitize ( body , mode , trim ) } ;;\n\n` ;
1919 return bodySnippet ;
@@ -27,7 +27,7 @@ function parseRawBody(body, mode, trim) {
2727 * @param {boolean } trim - trim body option
2828 * @returns {String } request body in the desired format
2929 */
30- function parseGraphQL ( body , mode , trim ) {
30+ function parseGraphQL ( body , mode , trim ) {
3131 let query = body . query ,
3232 graphqlVariables ,
3333 bodySnippet ;
@@ -52,7 +52,7 @@ function parseGraphQL(body, mode, trim) {
5252 * @param {boolean } trim - trim body option
5353 * @returns {String } request body in the desired format
5454 */
55- function parseURLEncodedBody ( body , mode , trim ) {
55+ function parseURLEncodedBody ( body , mode , trim ) {
5656 var payload , bodySnippet ;
5757 payload = _ . reduce ( body , function ( accumulator , data ) {
5858 if ( ! data . disabled ) {
@@ -73,24 +73,24 @@ function parseURLEncodedBody(body, mode, trim) {
7373 * @param {String } indent - indentation string
7474 * @returns {String } request body in the desired format
7575 */
76- function parseFormData ( body , trim , indent ) {
76+ function parseFormData ( body , trim , indent ) {
7777 var parameters = '[|\n' + _ . reduce ( body , ( accumalator , data ) => {
78- if ( ! data . disabled || data . disabled === false ) {
79- const key = sanitize ( data . key , 'formdata-key' , trim ) ;
78+ if ( ! data . disabled || data . disabled === false ) {
79+ const key = sanitize ( data . key , 'formdata-key' , trim ) ;
8080
81- if ( data . type === 'file' ) {
82- const filename = data . src ;
83- accumalator . push ( `${ indent } [| ("name", "${ key } "); ("fileName", "${ filename } ") |]` ) ;
84- }
85- else {
86- const value = sanitize ( data . value , 'formdata-value' , trim ) ;
87- accumalator . push ( `${ indent } [| ("name", "${ key } "); ("value", "${ value } ")` +
88- ( data . contentType ? `; ("contentType", "${ data . contentType } ")` : '' ) +
89- ' |]' ) ;
81+ if ( data . type === 'file' ) {
82+ const filename = data . src ;
83+ accumalator . push ( `${ indent } [| ("name", "${ key } "); ("fileName", "${ filename } ") |]` ) ;
84+ }
85+ else {
86+ const value = sanitize ( data . value , 'formdata-value' , trim ) ;
87+ accumalator . push ( `${ indent } [| ("name", "${ key } "); ("value", "${ value } ")` +
88+ ( data . contentType ? `; ("contentType", "${ data . contentType } ")` : '' ) +
89+ ' |]' ) ;
90+ }
9091 }
91- }
92- return accumalator ;
93- } , [ ] ) . join ( ';\n' ) + '\n|];;' ,
92+ return accumalator ;
93+ } , [ ] ) . join ( ';\n' ) + '\n|];;' ,
9494 bodySnippet = '' ;
9595
9696 bodySnippet = `let parameters = ${ parameters } \n` ;
@@ -129,7 +129,7 @@ function parseFormData(body, trim, indent) {
129129 *
130130 * @returns {String } request body in the desired format
131131 */
132- function parseFile ( ) {
132+ function parseFile ( ) {
133133 // var bodySnippet = 'let load_file f =\n';
134134 // bodySnippet += `${indent}let ic = open_in f in\n`;
135135 // bodySnippet += `${indent}let n = in_channel_length ic in\n`;
@@ -150,7 +150,7 @@ function parseFile() {
150150 * @param {String } indent - indentation string
151151 * @returns {String } utility function for getting request body in the desired format
152152 */
153- function parseBody ( body , trim , indent ) {
153+ function parseBody ( body , trim , indent ) {
154154 if ( ! _ . isEmpty ( body ) && ( ! _ . isEmpty ( body [ body . mode ] ) ) ) {
155155 switch ( body . mode ) {
156156 case 'urlencoded' :
@@ -161,7 +161,7 @@ function parseBody(body, trim, indent) {
161161 return parseGraphQL ( body . graphql , 'raw' , trim ) ;
162162 case 'formdata' :
163163 return parseFormData ( body . formdata , trim , indent ) ;
164- /* istanbul ignore next */
164+ /* istanbul ignore next */
165165 case 'file' :
166166 return parseFile ( indent ) ;
167167 default :
@@ -179,7 +179,7 @@ function parseBody(body, trim, indent) {
179179 * @param {String } indent - indent indent string
180180 * @returns {String } request headers in the desired format
181181 */
182- function parseHeaders ( bodyMode , headers , indent ) {
182+ function parseHeaders ( bodyMode , headers , indent ) {
183183 var headerSnippet = '' ;
184184 if ( ! _ . isEmpty ( headers ) ) {
185185 headers = _ . reject ( headers , 'disabled' ) ;
@@ -205,7 +205,7 @@ function parseHeaders(bodyMode, headers, indent) {
205205 * @param {String } method - method type of request
206206 * @returns {String } Method argument for ocaml call function
207207 */
208- function getMethodArg ( method ) {
208+ function getMethodArg ( method ) {
209209 var methodArg = '' ,
210210 supportedMethods = [ 'GET' , 'POST' , 'PUT' , 'PATCH' , 'DELETE' , 'HEAD' ] ,
211211 flag = false ;
@@ -263,7 +263,7 @@ self = module.exports = {
263263 type : 'positiveInteger' ,
264264 default : 0 ,
265265 description : 'Set number of milliseconds the request should wait for a response' +
266- ' before timing out (use 0 for infinity)'
266+ ' before timing out (use 0 for infinity)'
267267 } ,
268268 {
269269 name : 'Follow redirects' ,
0 commit comments