-
Notifications
You must be signed in to change notification settings - Fork 1.4k
refactor http client #3255
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
refactor http client #3255
Conversation
@swift-ci please smoke test |
Compilation error on Linux only? The PR looks good overall. |
bf190d2
to
c21a18a
Compare
motivation: * safer handling of large responses * prepare to consolidate Downloader from TSC and http client from Basics changes: * add progress support to HTTPclient::execute and URLSession based impl * add HTTPClientRequest::Options::maxResponseSize and logic to fail the request if response is too large * add authorization support to HTTPClientRequest::Options and HTTPClient::Configuration * refactor call-sites to use new ways * add and adopt tests
c21a18a
to
d3500ba
Compare
@@ -8,28 +16,84 @@ import struct TSCUtility.Versioning | |||
import FoundationNetworking | |||
#endif | |||
|
|||
public struct URLSessionHTTPClient: HTTPClientProtocol { | |||
public final class URLSessionHTTPClient: NSObject, HTTPClientProtocol { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neonichu ptal 👀
self.underlying( | ||
request, | ||
{ received, expected in | ||
if let max = request.options.maximumResponseSizeInBytes { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yim-lee this is to better support "maximumResponseSizeInBytes" at the response buffering time
@@ -275,15 +275,48 @@ class JSONPackageCollectionProviderTests: XCTestCase { | |||
}) | |||
} | |||
|
|||
func testExceedsDownloadSizeLimitProgress() throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yim-lee 👀
@swift-ci please smoke test |
yea seems like some of the nicer APIs are not supported on Linux, so had to do it the hard way... PR updated |
motivation: prepare to consolidate downloader from TSC and http client from Basics
changes: