How to use the put function from request

Find comprehensive JavaScript request.put code examples handpicked from public code repositorys.

180
181
182
183
184
185
186
187
188
189
if (err) {
    logger.log("error", "Tried to publish a screenshot to nonexistent package " + req.params.id);
    res.send(err, 400);
    return;
}
var putReq = request.put(
    {
        url:burrowBase + "/registry/" + req.params.id + "/screenshot.png?rev=" + body._rev ,
        headers:{"Content-Type":"image/png", Authorization:"Basic " + auth._auth, "Content-Length":req.headers["content-length"]},
        body:buffer
fork icon137
star icon0
watch icon34

+ 3 other calls in file

735
736
737
738
739
740
741
742
743
744
745


//datacite api doc >  https://mds.test.datacite.org/static/apidoc
//set / update the url associated with doi
exports.doi_put_url = function(doi, url, cb) {
    console.log("registering doi url", url);
    request.put({
        url: config.datacite.api+"/doi/"+doi,
        auth: {
            user: config.datacite.username,
            pass: config.datacite.password,
fork icon9
star icon8
watch icon4

+ 175 other calls in file

190
191
192
193
194
195
196
197
198
199

var url = this.baseApiUri + this._setAccessToken(path);

var options = this._generateReqOptions(url, path, body, 'PUT', headers);

request.put(options, function onPut(err, response, body) {
  if (!handleHttpError(err, response, callback)) {
    if (body) {
      var obj = JSON.parse(body);
      callback(null, obj);
fork icon0
star icon1
watch icon0

29
30
31
32
33
34
35
36
37
38
39
  }
})


const seed = (index, type, settings, callback) => {
  const payload = { url: baseUrl + '/' + index, body: JSON.stringify(settings) }
  request.put(payload, (err, response) => { // create the index first with potential custom analyzers before seeding
    should.not.exist(err)
    let started = 0
    for (const key in seeds) {
      started++
fork icon0
star icon0
watch icon1

+ 5 other calls in file

112
113
114
115
116
117
118
119
120
121
// the URL for the backend service should be set in configuration 
// using an environment variable. Here, the variable is passed 
// to npm start inside package.json:
//  "start": "BACKEND_URL=http://localhost:8082 node server.js",
// changed to a put now that real data is being updated
request.put(  // first argument: url + data + formats
    {
        url: SERVER + '/event/like',  // the microservice end point for liking an event
        body: req.body,  // content of the form
        headers: { // uploading json
fork icon0
star icon0
watch icon0