0

I have an http post call with dispatch like this,

 url(API_HOST + URL).POST <:<
          headers <:<
          Map("Content-Type" -> "application/x-www-form-urlencoded") <<
          "name=SomeName&parentId=SomeParentID"

To add the Content-Lenght, what is the correct way of calculating the bytes,

Map("Content-Length" -> string.getBytes("UTF-8").length()toString)

I'm not sure if this should work, or is setted by default form dispatch

anquegi
  • 11,125
  • 4
  • 51
  • 67

1 Answers1

0

I didn't need to add the content lengt this is added by the underlying librarie, the only thing that you must do is add the content:

 url(API_HOST_URL).POST <:<
otherheadersAsMAp <:<
Map("Content-Type" -> "application/x-www-form-urlencoded") << 
"name=SomeName&parentId=SomeParentID"
anquegi
  • 11,125
  • 4
  • 51
  • 67