URLRequest equality doesn't include httpBody
URLRequest
is the Swift overlay type for the Foundation type NSURLRequest
, so that that ==
ultimately calls the isEqual()
method of
the NSURLRequest
.
The Foundation library is open source for non-Apple platforms, and at NSURLRequest.swift#L245 we find:
open override func isEqual(_ object: Any?) -> Bool {
//On macOS this fields do not determine the result:
//allHTTPHeaderFields
//timeoutInterval
//httBody
//networkServiceType
//httpShouldUsePipelining
guard let other = object as? NSURLRequest else { return false }
return other === self
|| (other.url == self.url
&& other.mainDocumentURL == self.mainDocumentURL
&& other.httpMethod == self.httpMethod
&& other.cachePolicy == self.cachePolicy
&& other.httpBodyStream == self.httpBodyStream
&& other.allowsCellularAccess == self.allowsCellularAccess
&& other.httpShouldHandleCookies == self.httpShouldHandleCookies)
So that seems to be intentional.