Is this the correct way of doing a post in HTTPoison?


I have a POST request that I do using CURL the following way:

curl --data “reqCode=validateOfficeDetails&currLanguage=ca_ES” -X POST

My objective is to replicate this request using HTTPoison.


Thus far, this is how I am doing it:"", "reqCode=validateOfficeDetails&currLanguage=ca_ES", [{"Content-Type", "application/x-www-form-urlencoded"}])

But I am unsure this is the way to go because I am placing the --data parameters in what is the body.
Is this correct?

I would say yes? Is it not working?


POST data is sent in the request body, so I’d say yes :slight_smile:

You are correctly setting the Content-Type to form urlencoded, matching your data.

We are so used to HTTP abstractions that it’s easy to forget how HTTP is really just text: request method, headers and body, it’s that simple :wink: