0

Hy, I want to do calls to a different rest api from my play application. I'm using the javaws included library. The specific call requires that I send form data. However I have no idea how I can send the correct data along with my request. As far as I can see the library only supports sending url-encoded-form-data. Does anyone know how I can send form-data along with my request like a normal website doing a form submission?

At the moment I have this:

Promise<WSResponse> promise = WS.url("http://localhost:"+port+"/login").setContentType("multipart/form-data").post("emailAddress=" + email +"&password=" + password);

Thanks,

Michael Zajac
  • 55,144
  • 7
  • 113
  • 138
genz
  • 35
  • 2
  • 6

1 Answers1

0

Use application/x-www-form-urlencoded instead of multipart/form-data.

Promise<WSResponse> promise = WS.url("http://localhost:"+port+"/login")
                   .setContentType("application/x-www-form-urlencoded")
                   .post("emailAddress=" + email +"&password=" + password);
Alfaville
  • 543
  • 7
  • 16