Get 方法就可以,Post 就不行,
已经试过:.set('Content-Type', 'multipart/form-data') 这些方法了
对了 我在 stackoverflow 上面看见有人是这样解决的 .type('from') 但是我一旦使用这个方法 就会说
TypeError: First argument must be a string or Buffer
at ClientRequest.OutgoingMessage.end (_http_outgoing.js:555:11)
at Request.end (/Users/yumemor/Project/nodeProject/qrcode/node_modules/superagent/lib/node/index.js:873:9)
at Spide.login (/Users/yumemor/Project/nodeProject/qrcode/util/9thws.js:13:123)
at Object.<anonymous> (/Users/yumemor/Project/nodeProject/qrcode/app.js:16:7)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
发一个 Post 请求,真的没有想到会这样麻烦 各位有知道的吗? 先谢谢了。
回复 (5)
X
添加 .type('form') 之前报什么错误呢?
Y
引用 xcatliu添加 .type('form') 之前报什么错误呢?
@xcatliu 没有报错 就正常的发送 但是服务端收不到数据
X
@yumemor 那应该先看看发送的请求的内容有没有问题
Y
引用 xcatliu@yumemor 那应该先看看发送的请求的内容有没有问题
@xcatliu 只要换成 POST 服务端收不到 GET 正常 请求内容完全没有问题
H
不是
http.post('xxxxxxxxx_url', {
data1: xxxxx,
data2: xxxxx
}).end((err, res) => …… )
吗?
参与回复
登录后即可参与回复。登录