Replies: 3 comments 1 reply
-
It's not built into the top level APIs but you should be able to pass a |
Beta Was this translation helpful? Give feedback.
-
Hi @jshier I recently found this library however I have the same issue that I have a post request with query parameter and body? How could I achieve this? I look at the wiki examples but couldn't find, looked into QueryString for URLEncoded but still... |
Beta Was this translation helpful? Give feedback.
-
Things haven't fundamentally changed since my original reply. Alamofire doesn't offer anything built in to do this, but you should be able to compose our various struct QueryAndBodyParameters<Query: Encodable, Body: Encodable>: URLRequestConvertible {
let query: Query
let body: Body
func asURLRequest() throws -> URLRequest {
var request = ...
let queryEncoder = URLFormEncodedParameterEncoder(destination: .queryString)
try queryEncoder.encode(query, into: &request)
let bodyEncoder = JSONParameterEncoder()
try bodyEncoder.encode(body, into: &request)
return request
}
} Something like that can provide the basic structure you need. I'll convert this to a discussion in case other have any ideas. |
Beta Was this translation helpful? Give feedback.
-
Hi... I wanna send a request with query and body parameters...
Alamofire support this feature or i need to build the query parameters manually like this:
Beta Was this translation helpful? Give feedback.
All reactions