How to use the request.delete function in request

To help you get started, we’ve selected a few request examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SuperMap / iClient-JavaScript / examples-test / leaflet / 04_interpolationAnalystService_KrigingIT.js View on Github external
browser.pause(1000, function () {
            var exampleTestResult = "Kriging_Result";
            request.delete(GlobeParameter.dataspatialAnalystURL + exampleTestResult);
        });
        browser.end();
github SuperMap / iClient-JavaScript / examples-test / leaflet / 04_interpolationAnalystService_DensityIT.js View on Github external
browser.pause(1000, function () {
            var exampleTestResult = "Density_Result";
            request.delete(GlobeParameter.dataspatialAnalystURL + exampleTestResult);
        });
        browser.end();
github lodev09 / sbotify / src / lib / spotify.js View on Github external
return new Promise(async (resolve, reject) => {
            try {
                var token = await this.getAccessToken();
                var options = {
                    url: 'https://api.spotify.com/v1' + endPoint,
                    headers: { 'Authorization': 'Bearer ' + token },
                    json: true
                };

                if (data) options.body = data;

                console.log('DELETE: ' + endPoint);

                request.delete(options, function(error, response, body) {
                    if (!error && Spotify.requestOk(response)) {
                        resolve(body || true);
                    } else {
                        console.log(body);
                        reject(response.statusCode);
                    }
                });
            } catch (err) {
                reject(err);
            }
        });
    }
github carlosnakane / microfrontend-containers / services / root-menu / frontend / static-server / register.js View on Github external
const unregister = function(onUnregister) {
    const data = {
      name: packageJson.name
    };
  
    request.delete(registryServer, {
      json: data
    }, onUnregister);
  }
github OfficeDev / microsoft-teams-sample-complete-node / src / apis / VSTSRequestAPI.ts View on Github external
callback(err, body);
        };

        switch (method.toLowerCase())
        {
            case "get":
                request.get(options, requestCallback);
                break;
            case "post":
                request.post(options, requestCallback);
                break;
            case "put":
                request.put(options, requestCallback);
                break;
            case "delete":
                request.delete(options, requestCallback);
                break;
        }
    };
}
github soajs / soajs.dashboard / utils / drivers / container / kubernetes.js View on Github external
function deleteReplicaSet(requestOptions, params, cb) {
					requestOptions = injectCerts(requestOptions);
					requestOptions.uri += '/' + params.rsName;
					requestOptions.body = {
						gracePeriodSeconds: 0
					};

					request.delete(requestOptions, function (error, response, body) {
						return cb(error, body);
					});
				}
github iondv / framework / core / impl / resource / OwnCloudStorage / index.js View on Github external
return new Promise((resolve,reject) => {
      request.delete(reqParams, (err, res) => {
        if (!err && (res.statusCode === 204 || res.statusCode === 404)) {
          return resolve(id);
        } else {
          return reject(err || new Error('Status code: ' + res.statusCode + '. ' + res.body));
        }
      });
    });
  };
github openode-io / openode-cli / modules / instanceRequest.js View on Github external
return new Promise((resolve, reject) => {

    if (!sitename || sitename == "") {
      reject({});
    }

    let url = cliConfs.getApiUrl() + 'instances/' + sitename + "/" + operation;

    url = `${url}?version=${packageJson.version}&id=${id}`;

    request.delete({
      headers: {
        "x-auth-token": config.token
      },
      url: url,
      json: true,
      timeout: 300000
    }, function optionalCallback(err, httpResponse, body) {
      if (err || httpResponse.statusCode != 200) {
        reject(body);
      } else {
        resolve(body);
      }
    });
  });
}
github kyma-incubator / varkes / app-connector-client / server / resources / api.js View on Github external
exports.deleteService = function deleteService(serviceID, cb) {
    request.delete(
        {
            url: `${CONFIG.URLs.metadataUrl}/${serviceID}`,
            agentOptions: {
                cert: fs.readFileSync(certFile),
                key: fs.readFileSync(keyFile)
            },
        }, function (error, httpResponse, body) {

            LOGGER.logger.info("inside delete service")
            LOGGER.logger.info("kyma returned: ")
            LOGGER.logger.info(body)
            cb(body)
        }
    )
}
github zone-eu / zmta-webadmin / lib / handler.js View on Github external
function deleteMessage(id, seq, callback) {
    request.delete(
        config.apiServer + '/message/' + id + '/' + (seq ? seq : ''),
        {
            json: true
        },
        (error, response, info) => {
            if (error || response.statusCode !== 200) {
                if (info && info.error) {
                    error = new Error(info.error);
                }
                return callback(error || new Error('Invalid response code ' + response.statusCode));
            }
            return callback(null, info);
        }
    );
}