Actually, we'll deliberately ignore all cookies set with the Set-Cookie header when printing the cURL description via RealHTTP. It's annoying; sometimes, it's helpful to set cookies in this manner instead of creating an NSHTTPCookie object.
In this task, we'll remove the where condition when printing header cookies.
private static func addHeaders(for request: URLRequest, whenIn client: HTTPClient, into components: inout [String]) {
let configuration = client.session.configuration
var headers = HTTPHeaders()
for header in configuration.headers where header.name != "Cookie" {
headers[header.name] = header.value
}
for header in request.headers where header.name != "Cookie" {
headers[header.name] = header.value
}
for header in headers {
let escapedValue = header.value.replacingOccurrences(of: "\"", with: "\\\"")
components.append("-H \"\(header.name.rawValue): \(escapedValue)\"")
}
}
What problem are you facing?
Actually, we'll deliberately ignore all cookies set with the
Set-Cookie
header when printing the cURL description via RealHTTP. It's annoying; sometimes, it's helpful to set cookies in this manner instead of creating anNSHTTPCookie
object.In this task, we'll remove the
where
condition when printing header cookies.Other Information
No response