mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-10 22:45:55 +05:45
LoadShedderIntegrationTests: verify requests are actually handled by load shedder (#2663)
This commit is contained in:
1 parent
5c35df27d9
commit
f9660fbd1f
5 files changed
+111
No files matched your search
@@ -113,6 +113,7 @@ extension HTTPClient {
|
||||
case signature = "X-Signature"
|
||||
case requestDate = "X-RevenueCat-Request-Time"
|
||||
case contentType = "Content-Type"
|
||||
case isLoadShedder = "X-RevenueCat-Fortress"
|
||||
|
||||
}
|
||||
|
||||
@@ -320,6 +321,11 @@ private extension HTTPClient {
|
||||
// If that can't be extracted, get status code from the parsed response.
|
||||
httpCode: urlResponse?.httpStatusCode ?? response.statusCode
|
||||
))
|
||||
|
||||
if response.isLoadShedder {
|
||||
Logger.debug(Strings.network.request_handled_by_load_shedder(request.httpRequest.path))
|
||||
}
|
||||
|
||||
case let .failure(error):
|
||||
Logger.debug(Strings.network.api_request_failed(request.httpRequest,
|
||||
httpCode: urlResponse?.httpStatusCode,
|
||||
@@ -531,6 +537,10 @@ private extension HTTPResponse {
|
||||
}
|
||||
}
|
||||
|
||||
var isLoadShedder: Bool {
|
||||
return self.value(forHeaderField: HTTPClient.ResponseHeader.isLoadShedder.rawValue) == "true"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private extension HTTPResponse where Body == Data {
|
||||
|
||||
Reference in new issue
Block a user