0

使用 Vimeo 的 API 完成 PUT 上传时遇到问题。上传进度调用返回:“错误:options.uri 是必需的参数。”

请注意,一切似乎都可以正确上传;在存在错误的情况下,我只是对成功持怀疑态度。

相关代码(Node.js)如下:

app.post('/api/vimeo/complete', function(req, res) {
request({
    method: 'PUT',
    json: true,
    url: req.body.upload_link_secure,
    headers: {
        'Authorization': 'Bearer OBSCURO-PATRONUM',
        'Content-Range': '*/*'
    }
}, function(error, response, body){
    //console.log('Headers: ' + JSON.stringify(response.headers));
    console.log('progress error: ' + error);
    fs.writeFile('server_logs/vimeo-progress-log.json', JSON.stringify(response), function(err) {
        if (err) {
            console.log('log writing error: ' + err);
        } else {
            console.log('Vimeo progress log written.');
        }
    });
    res.json(body);
});
request({
    method: 'DELETE',
    json: true,
    url: 'https://api.vimeo.com' + req.body.uri,
    headers: {
        'Authorization': 'Bearer OBSCURO-PATRONUM'
    }
}, function(error, response, body){
    console.log('complete error: ' + error);
    console.log('complete body: ' + body);
    res.json(body);
});
});
4

1 回答 1

1

Try using uri instead of url in the object passed to the request method. The docs claim both work (https://github.com/request/request#requestoptions-callback) but you might be using a different version of the library.

This definitely sounds like a request error, not a vimeo error.

于 2015-03-26T15:49:15.867 回答