title: URLRequest equality doesn't include httpBody
body: <h2>Overview</h2>
  
  <p>There are 2 <code>URLRequest</code>s, one with <code>httpBody</code> and one with no <code>httpBody</code>.<br>
  However when compared, it shows both are equal.</p>
  
  <h2>Question</h2>
  
  <p>Is this expected behaviour or am I missing something ?</p>
  
  <h2>Code</h2>
  
  <pre><code>let url = URL(string: "www.somevalidURL.com")!
  
  var r1 = URLRequest(url: url)
  r1.addValue("Content-Type", forHTTPHeaderField: "application/json; charset=utf-8")
  r1.httpBody = makeBody(withParameters: ["email" : "a@b.com"])
  
  var r2 = URLRequest(url: url)
  r2.addValue("Content-Type", forHTTPHeaderField: "application/json; charset=utf-8")
  
  if r1 == r2 {
      print("requests are equal")
  }
  else {
      print("requests are not equal")
  }
  
  if r1.httpBody == r2.httpBody {
      print("body is equal")
  }
  else {
      print("body is not equal")
  }
  
  func makeBody(withParameters bodyParameters: [String : Any]?) -&gt; Data? {
      guard let bodyParameters = bodyParameters,
          !bodyParameters.isEmpty else {
              return nil
      }
      let body : Data?
      do {
          body = try JSONSerialization.data(withJSONObject: bodyParameters,
                                            options: .prettyPrinted)
      }
      catch {
          print("Error in creating Web Service Body = \(error)")
          body = nil
      }
      return body
  }
  </code></pre>
  
  <h2>Output</h2>
  
  <pre><code>requests are equal
  body is not equal
  </code></pre>
  
  <hr>
  
  <p><sub>Xcode 10<br>
  Swift Version: 4.2</sub></p>