-
Notifications
You must be signed in to change notification settings - Fork 338
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
Trusted Entitlements
: update handling of 304 responses
#2698
Conversation
f3654ae
to
90a95d8
Compare
38c9d99
to
fd49f15
Compare
90a95d8
to
12283d5
Compare
fd49f15
to
5b3a59d
Compare
12283d5
to
5741e29
Compare
5b3a59d
to
83757b0
Compare
4875780
to
6d5da7b
Compare
250270c
to
b0782ab
Compare
6d5da7b
to
e9e2d8e
Compare
b0782ab
to
a11ae88
Compare
e9e2d8e
to
4d7e631
Compare
88a3120
to
62010bf
Compare
b4e4adc
to
dd41618
Compare
var responseHeaders: HTTPClient.ResponseHeaders | ||
var body: Body | ||
var requestDate: Date? | ||
var verificationResult: VerificationResult |
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.
This is removed from HTTPResponse
now, so it no longer defaults to .notRequested
.
|
||
/// Equivalent to `HTTPURLResponse.value(forHTTPHeaderField:)` | ||
/// In keeping with the HTTP RFC, HTTP header field names are case-insensitive. | ||
func value(forHeaderField field: String) -> String? { |
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.
A nice refactor here: this is now defined on the protocol HTTPResponseType
so it's available for both response types.
Also no longer accepting any String
, enforcing that we use this only with HTTPClient.ResponseHeader
s and not HTTPClient.RequestHeader
s
1265476
to
c101849
Compare
|
||
/// - Returns: the most restrictive ``VerificationResult`` based on the cached verification and | ||
/// the response verification. | ||
static func from(cache cachedResult: Self, response responseResult: Self) -> Self { |
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.
This is gone 🎉
62010bf
to
e654254
Compare
fb1b4c9
to
7181dba
Compare
This is ready again 🎉 |
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.
Everything makes sense!
|
||
// MARK: - VerifiedHTTPResponse | ||
|
||
struct VerifiedHTTPResponse<Body: HTTPResponseBody>: HTTPResponseType { |
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.
In Android, I'm still keeping only the HTTPResponse
object (in android that's HTTPResult
. In Android, that's created within the ETagManager
, (which I admit, it's a weird responsibility to have there), but we don't need to default to NOT_REQUESTED
.
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.
I kept this refactor cause it made things cleaner on iOS.
9d3ee66
to
92b1d1c
Compare
7181dba
to
ba53303
Compare
6d66630
to
4d8fd34
Compare
- `ETagManager` no longer knows anything about signatures - `HTTPClient` loads cached response from `ETagManager` first before verifying signature with the cached body - Created new `VerifiedHTTPResponse`, which has the `VerificationResult`, extracted from `HTTPResponse` - Removed `VerificationResult.from(cache:response:)` - Updated `MockETagManager` to reflect behavior changed in #2666 - Removed `ETagManager` tests about verification since they're no longer relevant - Removed several `HTTPClient` tests that were checking a behavior that was impossible (for example, no verification result despite it being enabled), or that checked behavior based on the cached `VerificationResult`
ba53303
to
1876819
Compare
Changes:
ETagManager
no longer stores the verification modeVerifiedHTTPResponse
, which has theVerificationResult
, extracted fromHTTPResponse
VerificationResult.from(cache:response:)
SignatureVerificationHTTPClientTests
to test using the realETagManager
, so they become more "end to end" unit tests. A lot of them were relying on implementation details of the mock instead of the realETagManager
.HTTPClient
tests that were checking a behavior that was impossible (for example, no verification result despite it being enabled), or that checked behavior based on the cachedVerificationResult
Depends on #2679 and #2697.