Insomnia: POST Request Json Body Not Sending

Created on 12 Jun 2019  ยท  10Comments  ยท  Source: Kong/insomnia

  • Insomnia Version: _6.5.4__
  • Operating System: _Mac OS High Sierra__

Details

For whatever reason the POST req.body would not send through to my API. It was a simple JSON Body object i.e. {"username": "example", "password":"pass"}. At one point I restarted Insomnia and changed around the Body settings and it worked, but then broke again.

Most helpful comment

@cashcoder88 I found my problem.
try to add this.express.use(express.json()) in your server :)

All 10 comments

๐Ÿ‘‹ Thanks for opening your first issue! If you're reporting a ๐Ÿž bug, please make sure
you include steps to reproduce it. If you're requesting a feature ๐ŸŽ, please provide real
use cases that would benefit. ๐Ÿ‘ช

To help make this a smooth process, please be sure you have first read the
contributing guidelines.

There should be more info as to what's happening in the Timeline tab.

I am also facing this problem.

Timeline tab:

`* Preparing request to http://localhost:5000/signup

  • Using libcurl/7.54.0 LibreSSL/2.6.5 zlib/1.2.11 nghttp2/1.24.1
  • Current time is 2019-06-17T02:34:00.498Z
  • Disable timeout
  • Enable automatic URL encoding
  • Enable SSL validation
  • Enable cookie sending with jar of 0 cookies
  • Found bundle for host localhost: 0x7f854af75340 [can pipeline]
  • Re-using existing connection! (#6) with host localhost
  • Connected to localhost (::1) port 5000 (#6)

POST /signup HTTP/1.1
Host: localhost:5000
User-Agent: insomnia/6.5.4
Content-Type: application/json
Accept: /
Content-Length: 85

| {
| "name": "test",
| "email": "test",
| "password": "12345453",
| "user_type": "admin"
| }

  • upload completely sent off: 85 out of 85 bytes

< HTTP/1.1 200 OK
< X-Powered-By: Express
< Content-Type: application/json; charset=utf-8
< Content-Length: 16
< ETag: W/"10-/VnJyQBB0+b7i4NY83P42KKVWsM"
< Date: Mon, 17 Jun 2019 02:34:00 GMT
< Connection: keep-alive

  • Received 16 B chunk
  • Connection #6 to host localhost left intact`

System Info:

info

@cashcoder88 I found my problem.
try to add this.express.use(express.json()) in your server :)

๐Ÿ˜„

Bad post requisitions.
I spent hours reviewing my code just to realize the bug wasn't in my application. You should tell users about the issues software has.

What's the issue the software has, @wellingtonmacena? In my case, I came here after thinking the Insomnia had an issue as well, but then I realized I hadn't included the express.json() middleware in my application - which means Insomnia was fine.

It happened with me. req.body = {} with insomnia, req.body = { content } with postman.

Yah. I had the same! but cleaning the json just settind "No Body" and setting "JSON" again solve my prob! Hope solve yours also!
And I break my head thinkin the error is my code! chears!!!

To me, the problem was sending a "Digest" authentication with a JSON body. I could see on the timeline that the content-length was zero. Once I disabled the authentication, the body was sent.

Was this page helpful?
0 / 5 - 0 ratings