最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Using Fiddler to generate POST request with body - Stack Overflow

programmeradmin0浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 7

In the header: Content-Type: application/json In the body: {"key": "value"}

发布评论

评论列表(0)

  1. 暂无评论