2

I'm using Runscope to test my Node/Express app and I can't figure out how to send a JSON Body via a POST request in Runscope. Everything I've tried can't be parsed by the express bodyParser. The JSON I'm want to send looks like this:

{ "variable1":"value1",
  "variable2": {
      "variable3": "value2"
  }
}
ac360
  • 7,735
  • 13
  • 52
  • 91

1 Answers1

2

I tried the request with your JSON body and it seems to work for me against an "echo" API. I have created a shared request so you can see what the request looks like here.

Try this,

  • Go to the Traffic Inspector, and click "New Request". That will take you to the Request Editor.
  • Select POST instead of GET and enter the URL of your node express app.
  • Click on "Add Json" and add your JSON data in the "Request Data" field.
  • Click Launch Request.
Darrel Miller
  • 139,164
  • 32
  • 194
  • 243
  • Thanks Darrel. I was going to Radar and then creating my requests in there, which has a limited interface and does not show the Add JSON Option. I don't know why it's like that :\ – ac360 Oct 24 '14 at 23:53
  • 2
    @ac360 In a radar test you need to use "add body" and then you might have to set a Content-Type header equal to application/json, depending on how your server works. I'll talk to the team about changing the Radar UI to be more like the create request UI. I'm pretty sure it is on their to-do list. – Darrel Miller Oct 25 '14 at 01:11
  • Hi Darrel, I was missing the Content-Type header set to 'application/json'. Having those requests editors be visually alike, or even better, having a single request editor would be very helpful since as a user, I don't understand why they would be separate. – ac360 Oct 29 '14 at 21:50