I have a node.js service and it accepts POST requests. I am trying to use Fiddler to generate the post request. However, when I print the request body in my service, I get an empty object with no data in it. I set the request body in Fiddler to something such as {key:value}
. When printing request.body
in the node.js service I get an empty object {}
.
The request header:
User-Agent: Fiddler
Host: localhost:3000
Content-Length: 10
The body:
{ key:ky }
What am I doing wrong here?
I have a node.js service and it accepts POST requests. I am trying to use Fiddler to generate the post request. However, when I print the request body in my service, I get an empty object with no data in it. I set the request body in Fiddler to something such as {key:value}
. When printing request.body
in the node.js service I get an empty object {}
.
The request header:
User-Agent: Fiddler
Host: localhost:3000
Content-Length: 10
The body:
{ key:ky }
What am I doing wrong here?
Share Improve this question edited Aug 4, 2014 at 4:48 RagHaven asked Aug 4, 2014 at 4:42 RagHavenRagHaven 4,34725 gold badges75 silver badges114 bronze badges 2-
1
if that's the body, it's not valid json, valid json is
{"key": "value"}
, otherwise please provide more code. – OneOfOne Commented Aug 4, 2014 at 4:51 - for example if I want to pass user object how do I do that ? Like this {User: "UserName"} ? – Roxy'Pro Commented Oct 4, 2016 at 12:48
1 Answer
Reset to default 7In the header: Content-Type: application/json
In the body: {"key": "value"}