title: Swift Alamofire HTTP Get Request
body: <p>Request code:</p>
  
  <pre><code>static func testRequest() {
          Alamofire.request(Constants.baseURL,
                            method: .get,
                            parameters: ["data": "contentperson son"]).response { response in
              print("Request: \(response.request)")
              print("Response: \(response.response)")
              print("Error: \(response.error)")
  
              if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
                  print("Data: \(utf8Text)")
              }
          }
      }
  </code></pre>
  
  <p>Source: <a href="https://github.com/Alamofire/Alamofire/blob/master/Documentation/Usage.md#response-handling" rel="nofollow noreferrer">Github ReadMe for Alamofire</a></p>
  
  <p>I'm having trouble.  The request should use <code>data: contentperson son</code> as the request body but it doesn't seem to be.  I am NOT returning a <code>JSON</code> object.  The connection is 100% made with the server but it doesn't seem to understand my request.  A python program to send this request DOES return information.  </p>
  
  <p>Request returns:</p>
  
  <pre><code>Request: Optional(URL?data=contentperson%20son)
  Response: Optional(&lt;NSHTTPURLResponse: 0x600000833dc0&gt; { URL: URL?data=contentperson%20son } { Status Code: 200, Headers {
      Connection =     (
          "keep-alive"
      );
      "Content-Encoding" =     (
          gzip
      );
      "Content-Type" =     (
          "text/html; charset=utf-8"
      );
      Date =     (
          "Wed, 18 Jul 2018 16:58:48 GMT"
      );
      Server =     (
          "nginx/1.10.3 (Ubuntu)"
      );
      "Transfer-Encoding" =     (
          Identity
      );
      "X-Frame-Options" =     (
          SAMEORIGIN
      );
  } })
  Error: nil
  Data: The request data is empty.
  </code></pre>
  
  <p>It is connecting to a Django server with request function:</p>
  
  <pre><code>def Hello(request):
  if(request.method == "GET"):
      data = request.body
      decoded_data = data.decode("utf-8")
      if(decoded_data == ''):
          return HttpResponse("The request data is empty.")
      decoded_data = decoded_data.split(" ")
      #decoded_data[0] is the model type (contentmedia, contenttext, contentperson, contentsite), decoded_data[1] is keyword
      try:
          connected_database = sqlite3.connect('db.sqlite3')
          c = connected_database.cursor()
          c.execute("select * from dataentry_" + decoded_data[0] + " where title like ('%" + decoded_data[1] + "%')")
          connected_database.commit()
          results = c.fetchall()
      except:
          return HttpResponse("Error in reading the database.")
      return HttpResponse(str(results))
  </code></pre>