I need to make request like this Postman one, but in Alamofire
curl -X DELETE
http://someUrl
-H 'authorization: JWT someToken'
-H 'cache-control: no-cache'
-H 'content-type: application/x-www-form-urlencoded'
-H 'postman-token: 0149ef1e-5d45-34ce-3344-4b658f01bd64'
-d id=someId
I guess it should be something like:
let headers = ["Content-Type": "application/x-www-form-urlencoded", "Authorization": "JWT someToken"]
let params: [String: Any] = ["id": "someId"]
Alamofire.request("http://someUrl", method: .delete, parameters: params, headers: headers).validate().responseJSON { responseJSON in
switch responseJSON.result {
case .success( _):
let data = responseJSON.result.value!
print(data)
case .failure(let error):
print(error.localizedDescription)
}
}
How can I check that my request has option like this from cUrl
- -d id=someId