title: How do I see Alamofire Request?
body: <p>I am trying to use Alamofire for an Api that has a Json body and a header requirement that needs Basic Authentication. When I test the call in Postman it works fine, however with AlamoFire I am getting a server error. </p>
  
  <p>I am trying to see what the call is that's going out from Alamofire - but I can't seem to see it:  (this is the code I am using) </p>
  
  <p>edit: </p>
  
  <p><strong>Error is below</strong></p>
  
  <blockquote>
    <p>["errors": { }, "errorMessages": &lt;__NSSingleObjectArrayI 0x6000000035c0>( Internal server error ) ]</p>
  </blockquote>
  
  <p><strong>Request is below</strong></p>
  
  <pre><code>  Alamofire.request(endpoint, method: .post, parameters: paramsEncoded, encoding: JSONEncoding.default, headers: headers)
          .responseJSON(completionHandler: { (response) in
              print(response.request) // This returns just the url eg "http://api.com
              print(response.request?.httpBody) // This returns `Optional(85 bytes)`
          })
  </code></pre>
  
  <p>I assume the request is not being created properly, but would be useful to understand what I should be seeing. </p>
  
  <p>Edit: this line helped from the other question : 
  <code>NSLog("Request: \(request!.httpMethod!) - \(request!.url!.absoluteString)\n\(request!.httpBody.map { body in String(data: body, encoding: .utf8) ?? "" } ?? "")")</code></p>
  
  <p>Thanks to the question I have linked to as a duplicate for the help. </p>