0
curl -k https://myserver/api/v1/rptoken --cert user.pem --key user.key -H "Content-type: application/x-www-form-urlencoded" -X POST -d "name=foo&name=bar"

I want to use the above curl call to verify the status code as well as catch the entire response from the server. How do I use superagent/supertest specifically, in a mocha test to do this ?

shanwar
  • 319
  • 1
  • 2
  • 19
  • 1
    According to [this supertest tag wiki](http://stackoverflow.com/tags/supertest/info), it's a high-level http library. Which means the answer to your question is "you would not use curl at all; you would use supertest". – Seth Battin Jul 11 '16 at 18:46

1 Answers1

-1

If I understand this correctly, you want to get the status code of the HTTP call. That would be as easy as adding -I to the curl command (and maybe -L too if you want to follow redirects):

So your command would become:

curl -I -k https://myserver/api/v1/rptoken --cert user.pem --key user.key -H "Accept: application/x-www-form-urlencoded" -H "Content-type: application/x-www-form-urlencoded" -X POST -d "name=foo&name=bar"

If your question is actually related to catching the response completely, please clarify.

Adi Chiru
  • 89
  • 1
  • 5