@@ -28,28 +28,28 @@ var request = module.exports._requestDefaults();
28
28
'turer'
29
29
] . forEach ( function ( type ) {
30
30
module . exports [ type ] = function ( params , callback ) {
31
- if ( ! callback ) { return request . get ( { url : type , qs : params } ) ; }
32
- request . get ( { url : type , qs : params } , callback ) ;
31
+ if ( ! callback ) { return request . get ( { url : encodeURIComponent ( type ) , qs : params } ) ; }
32
+ request . get ( { url : encodeURIComponent ( type ) , qs : params } , callback ) ;
33
33
} ;
34
34
35
35
module . exports [ type ] . post = function ( data , callback ) {
36
- if ( ! callback ) { return request . post ( { url : type , body : data } ) ; }
37
- request . post ( { url : type , body : data } , callback ) ;
36
+ if ( ! callback ) { return request . post ( { url : encodeURIComponent ( type ) , body : data } ) ; }
37
+ request . post ( { url : encodeURIComponent ( type ) , body : data } , callback ) ;
38
38
} ;
39
39
40
40
module . exports [ type ] . get = function ( id , callback ) {
41
- if ( ! callback ) { return request . get ( { url : type + '/' + id } ) ; }
42
- request . get ( { url : type + '/' + id } , callback ) ;
41
+ if ( ! callback ) { return request . get ( { url : encodeURIComponent ( type ) + '/' + id } ) ; }
42
+ request . get ( { url : encodeURIComponent ( type ) + '/' + id } , callback ) ;
43
43
} ;
44
44
45
45
module . exports [ type ] . put = function ( id , data , callback ) {
46
- if ( ! callback ) { return request . put ( { url : type + '/' + id , body : data } ) ; }
47
- request . put ( { url : type + '/' + id , body : data } , callback ) ;
46
+ if ( ! callback ) { return request . put ( { url : encodeURIComponent ( type ) + '/' + id , body : data } ) ; }
47
+ request . put ( { url : encodeURIComponent ( type ) + '/' + id , body : data } , callback ) ;
48
48
} ;
49
49
50
50
module . exports [ type ] . patch = function ( id , data , callback ) {
51
- if ( ! callback ) { return request . patch ( { url : type + '/' + id , body : data } ) ; }
52
- request . patch ( { url : type + '/' + id , body : data } , callback ) ;
51
+ if ( ! callback ) { return request . patch ( { url : encodeURIComponent ( type ) + '/' + id , body : data } ) ; }
52
+ request . patch ( { url : encodeURIComponent ( type ) + '/' + id , body : data } , callback ) ;
53
53
} ;
54
54
} ) ;
55
55
0 commit comments