@@ -9,7 +9,7 @@ export const faraday: Client = {
9
9
link : 'https://github.com/lostisland/faraday' ,
10
10
description : 'Faraday HTTP client' ,
11
11
} ,
12
- convert : ( { uriObj, queryObj, method : rawMethod , fullUrl , postData, allHeaders } , options = { } ) => {
12
+ convert : ( { uriObj, queryObj, method : rawMethod , postData, allHeaders } ) => {
13
13
const { push, blank, join } = new CodeBuilder ( ) ;
14
14
15
15
// To support custom methods we check for the supported methods
@@ -30,16 +30,16 @@ export const faraday: Client = {
30
30
'TRACE' ,
31
31
] ;
32
32
33
- if ( ! methods . includes ( method ) ) {
34
- push ( `# Faraday cannot currently run ${ method } requests. Please use another client.` )
33
+ if ( ! methods . includes ( method ) ) {
34
+ push ( `# Faraday cannot currently run ${ method } requests. Please use another client.` ) ;
35
35
return join ( ) ;
36
36
}
37
37
38
38
push ( "require 'faraday'" ) ;
39
39
blank ( ) ;
40
40
41
41
// Write body to beginning of script
42
- if ( postData . mimeType === 'application/x-www-form-urlencoded' ) {
42
+ if ( postData . mimeType === 'application/x-www-form-urlencoded' ) {
43
43
if ( postData . params ) {
44
44
push ( `data = {` ) ;
45
45
postData . params . forEach ( param => {
@@ -52,8 +52,12 @@ export const faraday: Client = {
52
52
53
53
push ( `conn = Faraday.new(` ) ;
54
54
push ( ` url: '${ uriObj . protocol } //${ uriObj . host } ',` ) ;
55
- if ( allHeaders [ 'content-type' ] || allHeaders [ 'Content-Type' ] ) {
56
- push ( ` headers: {'Content-Type' => '${ allHeaders [ 'content-type' ] || allHeaders [ 'Content-Type' ] } '}` ) ;
55
+ if ( allHeaders [ 'content-type' ] || allHeaders [ 'Content-Type' ] ) {
56
+ push (
57
+ ` headers: {'Content-Type' => '${
58
+ allHeaders [ 'content-type' ] || allHeaders [ 'Content-Type' ]
59
+ } '}`,
60
+ ) ;
57
61
}
58
62
push ( `)` ) ;
59
63
@@ -63,7 +67,7 @@ export const faraday: Client = {
63
67
const headers = Object . keys ( allHeaders ) ;
64
68
if ( headers . length ) {
65
69
headers . forEach ( key => {
66
- if ( key . toLowerCase ( ) !== 'content-type' ) {
70
+ if ( key . toLowerCase ( ) !== 'content-type' ) {
67
71
push ( ` req.headers['${ key } '] = '${ escapeForSingleQuotes ( allHeaders [ key ] ) } '` ) ;
68
72
}
69
73
} ) ;
@@ -72,9 +76,9 @@ export const faraday: Client = {
72
76
Object . keys ( queryObj ) . forEach ( name => {
73
77
const value = queryObj [ name ] ;
74
78
if ( Array . isArray ( value ) ) {
75
- push ( ` req.params['${ name } '] = ${ JSON . stringify ( value ) } ` )
79
+ push ( ` req.params['${ name } '] = ${ JSON . stringify ( value ) } ` ) ;
76
80
} else {
77
- push ( ` req.params['${ name } '] = '${ value } '` )
81
+ push ( ` req.params['${ name } '] = '${ value } '` ) ;
78
82
}
79
83
} ) ;
80
84
@@ -98,7 +102,7 @@ export const faraday: Client = {
98
102
}
99
103
100
104
push ( 'end' ) ;
101
- blank ( )
105
+ blank ( ) ;
102
106
push ( 'puts response.status' ) ;
103
107
push ( 'puts response.body' ) ;
104
108
0 commit comments