Answers for "alamofire add x-www-form-urlencoded body"

0

swift alamofire x-www-form-urlencoded

let param:Parameters=[
        "param":param]
   let headers:HTTPHeaders=[
        "Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"]
    
    Alamofire.request(url,method: .post,parameters: param,encoding: URLEncoding.httpBody, headers: headers).responseJSON{response in
....
 }
Posted by: Guest on July-21-2021
0

swift alamofire x-www-form-urlencoded

let headers = [
    "Content-Type": "application/x-www-form-urlencoded"
]
let parameters = [
    "myParameter": "value"
]
let url = NSURL(string: "https://something.com")!
Alamofire.request(.POST, url, parameters: parameters, headers: headers, encoding: .URLEncodedInURL).response { request, response, data, error in
    print(request)
    print(response)
    print(data)
    print(error)
}
Posted by: Guest on July-21-2021
0

swift alamofire x-www-form-urlencoded

let parameters: [String: [String]] = [
    "foo": ["bar"],
    "baz": ["a", "b"],
    "qux": ["x", "y", "z"]
]

// All three of these calls are equivalent
AF.request("https://httpbin.org/post", method: .post, parameters: parameters)
AF.request("https://httpbin.org/post", method: .post, parameters: parameters, encoder: URLEncodedFormParameterEncoder.default)
AF.request("https://httpbin.org/post", method: .post, parameters: parameters, encoder: URLEncodedFormParameterEncoder(destination: .httpBody))

// HTTP body: "qux[]=x&qux[]=y&qux[]=z&baz[]=a&baz[]=b&foo[]=bar"
Posted by: Guest on July-21-2021

Code answers related to "alamofire add x-www-form-urlencoded body"

Code answers related to "Swift"

Browse Popular Code Answers by Language