File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -59,15 +59,18 @@ export const nsurlsession: Client<NsurlsessionOptions> = {
59
59
// The user can just add/remove lines adding/removing body parameters.
60
60
blank ( ) ;
61
61
62
+ const [ head , ...tail ] = postData . params ;
62
63
push (
63
- `NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${ postData . params [ 0 ] . name } =${ postData . params [ 0 ] . value } " dataUsingEncoding:NSUTF8StringEncoding]];` ,
64
+ `NSMutableData *postData = [[NSMutableData alloc] initWithData:[@"${ head . name } =${ head . value } " dataUsingEncoding:NSUTF8StringEncoding]];` ,
64
65
) ;
65
66
66
- for ( let i = 1 , len = postData . params . length ; i < len ; i ++ ) {
67
+ tail . forEach ( ( { name , value } ) => {
67
68
push (
68
- `[postData appendData:[@"&${ postData . params [ i ] . name } =${ postData . params [ i ] . value } " dataUsingEncoding:NSUTF8StringEncoding]];` ,
69
+ `[postData appendData:[@"&${ name } =${ value } " dataUsingEncoding:NSUTF8StringEncoding]];` ,
69
70
) ;
70
- }
71
+ } ) ;
72
+ } else {
73
+ req . hasBody = false ;
71
74
}
72
75
break ;
73
76
Original file line number Diff line number Diff line change @@ -59,14 +59,15 @@ export const nsurlsession: Client<NsurlsessionOptions> = {
59
59
// The user can just add/remove lines adding/removing body parameters.
60
60
blank ( ) ;
61
61
if ( postData . params ) {
62
+ const [ head , ...tail ] = postData . params ;
62
63
push (
63
- `let postData = NSMutableData(data: "${ postData . params [ 0 ] . name } =${ postData . params [ 0 ] . value } ".data(using: String.Encoding.utf8)!)` ,
64
+ `let postData = NSMutableData(data: "${ head . name } =${ head . value } ".data(using: String.Encoding.utf8)!)` ,
64
65
) ;
65
- for ( let i = 1 , len = postData . params . length ; i < len ; i ++ ) {
66
- push (
67
- `postData.append("& ${ postData . params [ i ] . name } = ${ postData . params [ i ] . value } ".data(using: String.Encoding.utf8)!)` ,
68
- ) ;
69
- }
66
+ tail . forEach ( ( { name , value } ) => {
67
+ push ( `postData.append("& ${ name } = ${ value } ".data(using: String.Encoding.utf8)!)` ) ;
68
+ } ) ;
69
+ } else {
70
+ req . hasBody = false ;
70
71
}
71
72
break ;
72
73
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const fixtureFilter: string[] = [
38
38
*
39
39
* Switch to `true` in debug mode to put into effect.
40
40
*/
41
- const OVERWRITE_EVERYTHING = false ;
41
+ const OVERWRITE_EVERYTHING = Boolean ( process . env . OVERWRITE_EVERYTHING ) || false ;
42
42
43
43
const testFilter =
44
44
< T > ( property : keyof T , list : T [ keyof T ] [ ] ) =>
You can’t perform that action at this time.
0 commit comments