Closed didymu5 closed 3 years ago
Can you send an example of your request object and request headers? Do you add "content-type: application/json" as request header?
Request:
POST /api/cart/item?envlbl=etc HTTP/1.1 Host: localhost:8080 Connection: keep-alive Content-Length: 0 sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="90", "Google Chrome";v="90" X-pharmacyId: undefined X-IBM-client-Id: 5861ea12-91b0-4c90-a997-9d0602ad85fc sec-ch-ua-mobile: ?0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.72 Safari/537.36 X-env: dev3 Content-Type: application/json Accept: / Sec-Fetch-Site: same-site Sec-Fetch-Mode: cors Sec-Fetch-Dest: empty Referer: http://localhost:3000/ Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Cookie: ...
RES: HTTP/1.1 200 OK X-Powered-By: Express Accept-Ranges: bytes Cache-Control: public, max-age=0 Last-Modified: Tue, 13 Apr 2021 05:33:44 GMT ETag: W/"375-178c9b8a2ec" Content-Type: application/json; charset=UTF-8 Content-Length: 885 Date: Thu, 15 Apr 2021 23:10:59 GMT Connection: keep-alive Keep-Alive: timeout=5
Request headers say Content-Length: 0
. So I think body is empty.
thanks @muratcorlu I hadn't realized I wasn't correctly using fetch function.
Server.js is as follows
POST.js is as follows
The log I get is is just and empty
{}
How do I access the data in the body on my post calls?