-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set body data to a HTTPRequest
?
#15
Comments
It is not currently supported. We need to find good mechanisms for sending data, stream, file, and potentially multipart body, and it will likely be a part of the future server and client HTTP APIs rather than on the currency types themselves. https://github.com/atrick/swift-evolution/blob/bufferview-roadmap/visions/view-types.md |
In the meantime, I think we could add Currently, in order to send a I was thinking the following two convenience methods could be added: extension URLSession {
func data(
for request: HTTPRequest,
body: Data,
delegate: URLSessionTaskDelegate? = nil
) async throws -> (Data, HTTPResponse) {
…
}
func data(
for request: HTTPRequest,
bodyStream: InputStream,
delegate: URLSessionTaskDelegate? = nil
) async throws -> (Data, HTTPResponse) {
…
}
} |
We currently have these 2:
InputStream should be provided in |
Ah, I didn’t realize that
|
Upload task is a subclass of data task, so there is little difference between the 2 of them. It's recommended to use upload task instead of |
That seems not supported yet?
The text was updated successfully, but these errors were encountered: