CNode

对于https.request 的post请求如何给json参数

Xxiaxiaokang发布于13 年前最后回复13 年前2 回复9563 浏览0 收藏

不知道如果给予参与。请高手给教下!!

查看回复

回复 (2)

L
leslie#1·13 年前

var req = https.request({method: 'POST'}, function(res){}) req.write(JSON.stringify(jsonObject)); req.end();

Z
zengwenbing#2·13 年前

var http = require('http'); var options = { host: 'www.blackglory.co.cc', path: '/', method: 'POST', headers: { 'Accept': 'text/html' } }; var req = http.request(options, function(res) { console.log(res); //响应对象 }); req.end();

参与回复
登录后即可参与回复。登录