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
DataStreamRequest should produce the initial response before the stream #3401
Labels
Comments
1 task
For the future person looking at this issue, the flow appears to be:
(etc) You can also find an example server-side implementation in Home Assistant: |
jshier
added a commit
that referenced
this issue
Aug 31, 2023
### Issue Link 🔗 #3401 ### Goals ⚽ This PR adds `onHTTPResponse` closure hooks to `DataRequest` / `UploadRequest` and `DataStreamRequest` to enable the cancellation of requests before data is transferred, requests that need to check response info for later parsing, or peculiar requests that may trigger multiple response callbacks, like MJPEG streams. ### Implementation Details 🚧 Like the other value hooks, this API accepts a single closure. The only unique bit here is that there's second, disfavored, version of the API that allows the user to return `ResponseDisposition` value to cancel or end the request without the body. ### Testing Details 🔍 Streaming tests are being updated to check these events always fire before the other events. More tests are needed around cancellation or ending behavior to ensure that's really possible.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As mentioned in #3210,
DataStreamRequest
isn't as useful as it could be right now since it doesn't return the initial response info until after the stream is completed. If we implementurlSession(_:dataTask:didReceive:completionHandler:)
we may gain more visibility into the initial responses, as well as the separate boundary responses parsed for us byURLSession
.The text was updated successfully, but these errors were encountered: