File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -29,21 +29,24 @@ extension String {
2929 let pairs : [ String ] = self . componentsSeparatedByString ( " & " )
3030 for pair in pairs {
3131 var comps : [ String ] = pair. componentsSeparatedByString ( " = " )
32- if comps. count == 2 {
33- result [ comps [ 0 ] ] = comps [ 1 ] . stringByRemovingPercentEncoding
32+ if comps. count >= 2 {
33+ let key = comps [ 0 ]
34+ let value = comps. dropFirst ( ) . joinWithSeparator ( " = " )
35+ result [ key] = value. stringByRemovingPercentEncoding
3436 }
3537 }
3638 return result
3739 }
40+
3841}
3942
4043extension Dictionary {
4144
4245 var query : String {
4346 var parts = [ String] ( )
4447 for (key, value) in self {
45- let keyString = " \( key) " . stringByAddingPercentEncodingWithAllowedCharacters ( NSCharacterSet . URLQueryAllowedCharacterSet ( ) )
46- let valueString = " \( value) " . stringByAddingPercentEncodingWithAllowedCharacters ( NSCharacterSet . URLQueryAllowedCharacterSet ( ) )
48+ let keyString = " \( key) " . stringByAddingPercentEncodingWithAllowedCharacters ( NSCharacterSet . URLQueryAllowedCharacterSet ( ) ) !
49+ let valueString = " \( value) " . stringByAddingPercentEncodingWithAllowedCharacters ( NSCharacterSet . URLQueryAllowedCharacterSet ( ) ) !
4750 let query = " \( keyString) = \( valueString) "
4851 parts. append ( query)
4952 }
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ struct Request {
4040 let components = NSURLComponents ( )
4141 components. scheme = self . client. URLScheme
4242 components. host = kXCUHost
43- components. path = self . action
43+ components. path = " / \( self . action) "
4444 components. query = ( parameters + query) . query
4545 return components
4646 }
You can’t perform that action at this time.
0 commit comments