My current code looks like this and request httpBody I'm sending is also there
let params: [String: Any] = [
"user_id": defaults.object(forKey: "userID") as! Int,
"opid": opid
]
guard let url = URL(string: addOldPrescriptionURL) else { return }
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("text/html; charset=UTF-8", forHTTPHeaderField: "Content-Type")
request.httpBody = try! JSONSerialization.data(withJSONObject: params, options: [])
{"opid":["762"],"user_id":78}
But when I'm making the post request from PostMan using the parameters like user_id: 78 opid: ["762"] (without the double quotes) its working fine but mine is not working. Can anyone please help how can I remove those quotes from the request httpBody.