title: How to request JSON with body and header in Alamofire?
body: <p>I had tried with the following code for the request but result with 400 error.
  API consists of header and body. Header had two fields that are "Authorization" and "Content-Type". Body format is added to params below.</p>
  
  <p><a href="https://i.stack.imgur.com/WFTBv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WFTBv.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/0oF5K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0oF5K.png" alt="enter image description here"></a></p>
  
  <pre><code>    func file( sender: abc){
  
          let baseUrl = "url”
  
          let params: [String : Any] = [
              "profile": [
                  “Type": [
                      " Real Estate",
                      "Estater",
                      "Construction",
                      "Entertainment"
                  ],
                  "Size": [
                      "large",
                      “small”
                  ],
                  "Level": [
                      “A”,
                      “B”
                  ],
                  “Name” : [
                      “John”,
                      “Harry”
                  ]
              ]
          ]
  
          let header = [
              "Authorization" : "bearer e2ff3aa3-63a3-41d1-bc5a-3e8c88adeaaa",
              "Content-Type" : "application/json"
          ]
  
  //        var request = URLRequest(url: URL(string:baseUrl)!)
  //        request.httpMethod = HTTPMethod.post.rawValue
  //        request.setValue("application/json", forHTTPHeaderField: "Content-Type")
  //        request.addValue("bearer e2ff3aa3-63a3-41d1-bc5a-3e8c88adeaaa", forHTTPHeaderField: "Authorization")
  //        let data = try! JSONSerialization.data(withJSONObject: params as Any, options:JSONSerialization.WritingOptions.prettyPrinted)
  //        
  //        request.httpBody = data
  
          Alamofire.request("\(baseUrl)", method: .post, parameters: params, headers:header).responseJSON { response in
              print(response.request ?? "no request")  // original URL requ est
              print(response.response ?? "no response") // HTTP URL response
              print(response.data ?? "no data")     // server data
              print(response.result)   // result of response serialization
              print(response.response?.statusCode ?? "noCode")
  
              if(response.response?.statusCode != nil){
                  switch response.response!.statusCode {
                  case 200:
                      print("Success")
                      let json = JSON(data: response.data!)
                      print(json)
                      sender.onSuccessCall()
                  case 400:
                      print("Error in authentication")
                  case 401:
                      print("Error authentication object was not found")
                  default:
                      print("dEfault")
                  }
              }
          }
      }
  </code></pre>
  
  <p>Please help to slove on this problem.</p>