Question: Is there a way to get a cURL command out of the built RequestSpecification?

1,106 views
Skip to first unread message

jason....@compass.com

unread,
Apr 2, 2016, 1:15:20 AM4/2/16
to REST assured
New to REST assured and I must say I love this API. However, I have a question.

Is there a function which returns the RequestSpecificationImpl or RequestSpecification object as a cURL command? Or do I have to just write my own function to do this?

Johan Haleby

unread,
Apr 3, 2016, 2:22:59 AM4/3/16
to rest-a...@googlegroups.com
Yes there's a standalone project that does this, see here: https://github.com/dzieciou/curl-logger. It's available in Maven central as well: http://goo.gl/0trW13

/Johan

On Fri, Apr 1, 2016 at 10:03 PM, <jason....@compass.com> wrote:
New to REST assured and I must say I love this API. However, I have a question.

Is there a function which returns the RequestSpecificationImpl or RequestSpecification object as a cURL command? Or do I have to just write my own function to do this?

--
You received this message because you are subscribed to the Google Groups "REST assured" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-assured...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Maciej Gawinecki

unread,
Apr 27, 2016, 1:47:22 AM4/27/16
to REST assured
More precisely curl-logger generates curl command from actual requests sent by RestAssured not from request specification.

For instance, if in the request specification you don't have a cookie defined but there's a cookie in CookieStore and is being sent by HTTP client then curl-logger will put that cookie in the curl  command.

Disclaimer: I'm the author of curl-looger.

/Maciej

Gaurav Mahajan

unread,
Jul 10, 2019, 1:22:23 AM7/10/19
to REST assured
Hi,

I am not able to generate Correct Curl Command using curl-logger and restassured.The Mistake is Special Characters are getting appended in --User Value.

curl "https://api2-preprod.incentivenetworks.com/v0/auth/wl?partner_id=81211&iv=ExtLVWGlIkfSC32qOf5DUw"%"253D"%"253D"%"250A&token=9ydAWTxZ7qb9hXqKBELZ8MU0pN8IsSF53Bgu0tGe4BeYIpqWp"%"25252FYr6L5wDidRqWWTvvWFS9DPXtqd786"%"25250A5a8cc9vOovxnUGyCykVERBoEQd7LtuIVKIPNNeCDdfHsGhRgj"%"25252B4ol8B9XiKB"%"25252F5gc8eXy3Z"%"25252BUq1ka"%"25250AmTzKmCwR9WGXgKkTAw1rJbgxPThgkhmSwK4g08lt"%"25252B4j5FUt2sI1r9cizNfyJnw"%"25253D"%"25253D"%"25250A" --cookie "value" --header "Content-Type: application/json; charset=UTF-8" --header "Accept: */*" --header "Host: server.com" --header "Connection: Keep-Alive" --header "User-Agent: Apache-HttpClient/4.5.3 (Java/11.0.1)" --user "ashish:a26B)n^A?"%"6Wf!AsJw" --compressed --insecure --verbose

If i remove !AsJw from User,Then request works fine.You have to change the values in cookie and token
Reply all
Reply to author
Forward
0 new messages