REST-Easy icon indicating copy to clipboard operation
REST-Easy copied to clipboard

Add support for raw POST like curl's --data option

Open birtles opened this issue 8 years ago • 7 comments

Specifically, I was trying to use this with W3C's Echidna publication system but ran it to trouble since it complained that it doesn't support form data.

birtles avatar Sep 13 '16 04:09 birtles

Curl documentation says that

-d, --data <data>
              (HTTP) Sends the specified data in a POST request  to  the  HTTP
              server,  in  the  same  way  that a browser does when a user has
              filled in an HTML form and presses the submit button. This  will
              cause curl to pass the data to the server using the content-type
              application/x-www-form-urlencoded.

So doing a POST with Form body and MIME type application/x-www-form-urlencoded should work

mirkoperillo avatar Sep 13 '16 11:09 mirkoperillo

Yes, I read that too and expected the same. Unfortunately in practice it is not the same. curl --data works but form with application/x-www-form-urlencoded in REST easy does not.

birtles avatar Sep 13 '16 13:09 birtles

Do you have error or warning in javascript console or some message / http code error in response ?

This can be useful to understand where is the issue

mirkoperillo avatar Sep 13 '16 14:09 mirkoperillo

Sorry for the delay, you can reproduce simply by doing a POST to https://labs.w3.org/echidna/api/request The result returned is:

{"status":"Form Content-Type not supported"}

I get a 501 Not Implemented return code with the following headers:

Name Value
X-Powered-By Express
Content-Type application/json; charset=utf-8
Content-Length 44
Etag W/"2c-De5+vJK+2lj7uobm3ktF6w"
Vary Accept-Encoding
Date Thu, 15 Sep 2016 05:29:28 GMT
Strict-Transport-Security max-age=15552015; preload
Public-Key-Pins pin-sha256=.....

birtles avatar Sep 15 '16 05:09 birtles

I tried using the master branch version and it seems to work.

I tried a POST request with Form body, application/x-www-form-urlencoded MIME, given fake url, decision and token params and the service returns 202 http code and a Uuid

mirkoperillo avatar Sep 20 '16 12:09 mirkoperillo

This issue is silent for a month, maybe it can be closed.

If @birtles has news about he can always reopen it

mirkoperillo avatar Oct 24 '16 15:10 mirkoperillo

Thanks. Sorry, I haven't had time to try install a trunk version to test but I trust it works!

birtles avatar Oct 28 '16 07:10 birtles