How to set Content-Length when sending POST request in NodeJS?

后端 未结 4 726
甜味超标
甜味超标 2021-02-08 13:17
var https = require(\'https\');  

var p = \'/api/username/FA/AA?ZOHO_ACTION=EXPORT&ZOHO_OUTPUT_FORMAT=JSON&ZOHO_ERROR_FORMAT=JSON&ZOHO_API_KEY=dummy1234&         


        
4条回答
  •  臣服心动
    2021-02-08 14:00

    It turns out that the solution to the given problem, when you do want to make a POST request, is apparently to set the "headers" field of the options object to contain a 'Content-Length' field.

    See code here:

    How to make an HTTP POST request in node.js?

提交回复
热议问题