Reputation: 35
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,
Upvotes: 0
Views: 275
Reputation: 553
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);
Upvotes: 0