File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,15 +59,18 @@ export const nsurlsession: Client<NsurlsessionOptions> = {
5959 // The user can just add/remove lines adding/removing body parameters.
6060 blank ( ) ;
6161
62+ const [ head , ...tail ] = postData . params ;
6263 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]];` ,
6465 ) ;
6566
66- for ( let i = 1 , len = postData . params . length ; i < len ; i ++ ) {
67+ tail . forEach ( ( { name , value } ) => {
6768 push (
68- `[postData appendData:[@"&${ postData . params [ i ] . name } =${ postData . params [ i ] . value } " dataUsingEncoding:NSUTF8StringEncoding]];` ,
69+ `[postData appendData:[@"&${ name } =${ value } " dataUsingEncoding:NSUTF8StringEncoding]];` ,
6970 ) ;
70- }
71+ } ) ;
72+ } else {
73+ req . hasBody = false ;
7174 }
7275 break ;
7376
Original file line number Diff line number Diff line change @@ -59,14 +59,15 @@ export const nsurlsession: Client<NsurlsessionOptions> = {
5959 // The user can just add/remove lines adding/removing body parameters.
6060 blank ( ) ;
6161 if ( postData . params ) {
62+ const [ head , ...tail ] = postData . params ;
6263 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)!)` ,
6465 ) ;
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 ;
7071 }
7172 break ;
7273
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ const fixtureFilter: string[] = [
3838 *
3939 * Switch to `true` in debug mode to put into effect.
4040 */
41- const OVERWRITE_EVERYTHING = false ;
41+ const OVERWRITE_EVERYTHING = Boolean ( process . env . OVERWRITE_EVERYTHING ) || false ;
4242
4343const testFilter =
4444 < T > ( property : keyof T , list : T [ keyof T ] [ ] ) =>
You can’t perform that action at this time.
0 commit comments