Closed jjabba closed 9 years ago
The underlying OMGHTTPURLRQ supports this. PromiseKit should have a method added, so maybe submit a PR?
NSURLRequest *`rq = [OMGHTTPURLRQ POST:url JSON:jsonDictionary];
PMKPromise *promise = [NSURLConnection promise:rq];
The existing POST requests don't send JSON anyway, they send form url encoded data, with nesting support.
I'm using the swift version of PromiseKit. I've been trying to use NSURLConnection.POST to send a request to an JSON::RPC2 compatible API. I need to send JSON in my request such as: { "jsonrpc": "2.0", "method": "subtract", "params": [42, 23], "id": 1 }
But I havn't found a suitable construct for such a POST-request. All NSURLConnection.POST(...) variants seem to want flat json on the form: [String: String] (i.e Dictionary<String, String>)