PUT 与 'superagent' 模块

PUT with 'superagent' module

正在阅读 Superagent 文档,POST 和 PUT 请求之间没有区别:

  request.post('/user')
    .set('Content-Type', 'application/json')
    .send('{"name":"tj","pet":"tobi"}')
    .end(callback)

如何使用此包进行 PUT 请求?

DELETE, HEAD, POST, PUT and other HTTP verbs may also be used, simply change the method name.

所以,

request.put('/user')
    .set('Content-Type', 'application/json')
    .send('{"name":"tj","pet":"tobi"}')
    .end(callback)