@@ -46,9 +46,9 @@ module.exports = function (source, options) {
4646 // we make it easier for the user to edit it according to his or her needs after pasting.
4747 // The user can just add/remove lines adding/removing body parameters.
4848 code . blank ( )
49- . push ( 'let postData = NSMutableData(data: "%s=%s ".data(using: String.Encoding.utf8)!)' , source . postData . params [ 0 ] . name , source . postData . params [ 0 ] . value )
49+ . push ( 'let postData = NSMutableData(data: "%qd=%qd ".data(using: String.Encoding.utf8)!)' , source . postData . params [ 0 ] . name , source . postData . params [ 0 ] . value )
5050 for ( let i = 1 , len = source . postData . params . length ; i < len ; i ++ ) {
51- code . push ( 'postData.append("&%s=%s ".data(using: String.Encoding.utf8)!)' , source . postData . params [ i ] . name , source . postData . params [ i ] . value )
51+ code . push ( 'postData.append("&%qd=%qd ".data(using: String.Encoding.utf8)!)' , source . postData . params [ i ] . name , source . postData . params [ i ] . value )
5252 }
5353 break
5454
@@ -68,7 +68,7 @@ module.exports = function (source, options) {
6868 */
6969 code . push ( helpers . literalDeclaration ( 'parameters' , source . postData . params , opts ) )
7070 . blank ( )
71- . push ( 'let boundary = "%s "' , source . postData . boundary )
71+ . push ( 'let boundary = "%qd "' , source . postData . boundary )
7272 . blank ( )
7373 . push ( 'var body = ""' )
7474 . push ( 'var error: NSError? = nil' )
@@ -93,13 +93,13 @@ module.exports = function (source, options) {
9393
9494 default :
9595 code . blank ( )
96- . push ( 'let postData = NSData(data: "%s ".data(using: String.Encoding.utf8)!)' , source . postData . text )
96+ . push ( 'let postData = NSData(data: "%qd ".data(using: String.Encoding.utf8)!)' , source . postData . text )
9797 }
9898 }
9999
100100 code . blank ( )
101101 // NSURLRequestUseProtocolCachePolicy is the default policy, let's just always set it to avoid confusion.
102- . push ( 'let request = NSMutableURLRequest(url: NSURL(string: "%s ")! as URL,' , source . fullUrl )
102+ . push ( 'let request = NSMutableURLRequest(url: NSURL(string: "%qd ")! as URL,' , source . fullUrl )
103103 . push ( ' cachePolicy: .useProtocolCachePolicy,' )
104104 . push ( ' timeoutInterval: %s)' , parseInt ( opts . timeout , 10 ) . toFixed ( 1 ) )
105105 . push ( 'request.httpMethod = "%s"' , source . method )
0 commit comments