【发布时间】:2021-02-02 11:36:24
【问题描述】:
{
method: 'POST',
url: 'https://wandbox.org/api/compile.json',
compiler: 'cpython-3.8.0',
code: 'print("hello")',
headers: { 'Content-Type': 'application/json' }
}
当我将其作为“选项”并且我这样做时:
request.post(options, function optionalCallback(err, httpResponse, body) {
if (err) {
return console.error('upload failed:', err);
}
console.log(body)
console.log('Upload successful! Server responded with:', httpResponse);
})
body 什么都不是,在 httpResponse 中我得到了
statusCode: 400,
statusMessage: 'Bad Request',
这是为什么呢?我的要求有什么问题?我正在尝试关注https://github.com/melpon/wandbox/blob/master/kennel2/API.rst 但似乎没有任何效果。如何解决我的请求?
【问题讨论】: