Tabnine Logo For Javascript
Response.statusMessage
Code IndexAdd Tabnine to your IDE (free)

How to use
statusMessage
function
in
Response

Best JavaScript code snippets using request.Response.statusMessage(Showing top 15 results out of 315)

origin: dialogflow/dialogflow-nodejs-client

  reject(err);
} else if (resp.statusCode > 204) {
  let message = resp.statusMessage;
  if (resp.body && resp.body.message) {
    message += ", " + resp.body.message;
origin: dialogflow/dialogflow-nodejs-client

let message = resp.statusMessage;
if (resp.body && resp.body.message) {
  message += ", " + resp.body.message;
origin: zanran/node-redmine

this._request(path, opts, function(err, res, body) {
  if (err) return callback(err);

  if (res.statusCode != 200 && res.statusCode != 201) {
   var msg = {
    ErrorCode: res.statusCode,
    Message: res.statusMessage,
    Detail: body
   };
   return callback(JSON.stringify(msg));
  }

  return callback(null, isUpload ? JSON.parse(body) : body);
 })
origin: Autodesk-Forge/bim360appstore-data.management-nodejs-transfer.storage

request(source)
    .on('response', function (resSource) {
     if (process.env.CONSOLELOG)
      console.log('Download ' + source.url + ': ' + resSource.statusCode + ' > ' + resSource.statusMessage);

     sourceStatusCode = resSource.statusCode;
     resSource.headers['content-type'] = undefined; // if the source response have this header, Dropbox may file for some types
    })
    .pipe(request(destination)
     .on('response', function (resDestination) {
      if (process.env.CONSOLELOG)
       console.log('Upload ' + destination.url + ': ' + resDestination.statusCode + ' > ' + resDestination.statusMessage);

      MakeCallback(autodeskId, taskId, resDestination.statusCode, sourceStatusCode, data, callback);
     }));
origin: smart-on-fhir/fhir-server-dashboard

/**
 * Executes a GET request to the given URL and calls a callback function with the request's response
 * @param {String} url the URL from which to get data via a GET request
 * @param {Function} callback the callback function that is given the request's response
 */
function httpRequest(url, callback) {
  request({ url, json: true, headers: { accept: 'application/json', }, }, (error, res, json) => {
    if (error) throw error;
    if (res.statusCode >= 400) throw new Error(res.statusMessage);

    callback(json);
  });
}
origin: Pierce01/MinecraftLauncher-core

request.post(requestObject, function (error, response, body) {
   if (error) return reject(error)
   if (!body || !body.selectedProfile) {
    return reject(new Error('Validation error: ' + response.statusMessage))
   }

   const userProfile = {
    access_token: body.accessToken,
    client_token: uuid(),
    uuid: body.selectedProfile.id,
    name: body.selectedProfile.name,
    user_properties: JSON.stringify(body.user.properties || {})
   }

   resolve(userProfile)
  })
origin: micromaomao/schsrch

function listSubjectInLevel (level) {
 let levelUrl = levelUrlMapping[level.toLowerCase()]
 if (!levelUrl) throw new Error(`Unknown level ${level}`)
 return new Promise((resolve, reject) => {
  req({ uri: levelUrl, json: true }, (err, res, body) => {
   if (err) return void reject(err)
   if (res.statusCode !== 200) return void reject(new Error(`Error while loading ${levelUrl}: ${res.statusCode} (${res.statusMessage})`))
   if (res.headers['content-type'].indexOf('json') < 0) return void reject(new Error(`${levelUrl} should return json, but it didn't.`))
   let subjects = body
   try {
    resolve(subjects.map(s => ({ id: s.SyllabusCode.toString(), name: s.Title.replace(/\(\d{4}\)/, '').trim()})))
   } catch (e) {
    reject(new Error(`Unexpected API response - ${e.message}`))
   }
  })
 })
}
origin: eliashussary/dark-sky

get() {
  return new Promise((resolve, reject) => {
   if (!DarkSky.truthyOrZero(this.lat) || !DarkSky.truthyOrZero(this.long)) {
    reject("Request not sent. ERROR: Longitute or Latitude is missing.")
   }

   this._generateReqUrl()

   req(
    { url: this.url, json: true, timeout: this.timeoutVal, gzip: this.gzip },
    (err, res, body) => {
     if (err) {
      reject(`Forecast cannot be retrieved. ERROR: ${err}`)
      return
     }

     if (res.statusCode !== 200) {
      reject(
       `Forecast cannot be retrieved. Response: ${res.statusCode} ${
        res.statusMessage
       }`
      )
      return
     }

     resolve(body)
    }
   )
  })
 }
origin: IBM-Cloud/iot4i-api-examples-nodejs

cb( null, "Create user failed with : " + response.statusCode + " - " + response.statusMessage);
origin: mseminatore/TeslaJS

request(req, function (error, response, body) {
    if (error) {
      log(API_ERR_LEVEL, error);
      return callback(error, null);
    }

    if (response.statusCode != 200) {
      return callback(response.statusMessage, null);
    }

    log(API_BODY_LEVEL, "\nBody: " + JSON.stringify(body));
    log(API_RESPONSE_LEVEL, "\nResponse: " + JSON.stringify(response));

    try {
      body = body.response;
      
      callback(null, body);
    } catch (e) {
      log(API_ERR_LEVEL, 'Error parsing vehicles response');
      callback(e, null);
    }

    log(API_RETURN_LEVEL, "\nGET request: " + "/vehicles" + " completed.");
  });
origin: Pierce01/MinecraftLauncher-core

request.post(requestObject, function (error, response, body) {
   if (error) return reject(error)
   if (!body || !body.selectedProfile) {
    return reject(new Error('Validation error: ' + response.statusMessage))
   }

   const userProfile = {
    access_token: body.accessToken,
    client_token: body.clientToken,
    uuid: body.selectedProfile.id,
    name: body.selectedProfile.name,
    selected_profile: body.selectedProfile,
    user_properties: JSON.stringify(body.user.properties || {})
   }

   resolve(userProfile)
  })
origin: mseminatore/TeslaJS

request(req, function (error, response, body) {
    if (error) {
      log(API_ERR_LEVEL, error);
      return callback(error, null);
    }

    if (response.statusCode != 200) {
      return callback(response.statusMessage, null);
    }

    log(API_BODY_LEVEL, "\nBody: " + JSON.stringify(body));
    log(API_RESPONSE_LEVEL, "\nResponse: " + JSON.stringify(response));

    try {
      body = body.response[options.carIndex || 0];
      body.id = body.id_s;
      options.vehicleID = body.id;
      
      callback(null, body);
    } catch (e) {
      log(API_ERR_LEVEL, 'Error parsing vehicles response');
      callback(e, null);
    }

    log(API_RETURN_LEVEL, "\nGET request: " + "/vehicles" + " completed.");
  });
origin: mseminatore/TeslaJS

request(req, function(error, response, body) {
   if (error) {
    log(API_ERR_LEVEL, error);
    return callback(error, null);
   }

   if (response.statusCode != 200) {
    return callback(response.statusMessage, null);
   }

   log(API_BODY_LEVEL, "\nBody: " + JSON.stringify(body));
   log(API_RESPONSE_LEVEL, "\nResponse: " + JSON.stringify(response));

   try {
    body = body.response;

    callback(null, body);
   } catch (e) {
    console.log(e);
    log(API_ERR_LEVEL, "Error parsing products response");
    callback(e, null);
   }

   log(API_RETURN_LEVEL, "\nGET request: " + "/products" + " completed.");
  });
origin: Autodesk-Forge/bim360appstore-data.management-nodejs-transfer.storage

request(source)
    .on('response', function (resSource) {
     if (process.env.CONSOLELOG)
      console.log('Download ' + source.url + ': ' + resSource.statusCode + ' > ' + resSource.statusMessage);

     sourceStatusCode = resSource.statusCode;
     resSource.headers['content-type'] = undefined; // if the source response have this header, Dropbox may file for some types
    })
    .pipe(request(destination)
     .on('response', function (resDestination) {
      if (process.env.CONSOLELOG)
       console.log('Upload ' + destination.url + ': ' + resDestination.statusCode + ' > ' + resDestination.statusMessage);

      MakeCallback(autodeskId, taskId, resDestination.statusCode, sourceStatusCode, data, callback);
     }));
origin: mseminatore/TeslaJS

request(req, function(error, response, body) {
   if (error) {
    log(API_ERR_LEVEL, error);
    return callback(error, null);
   }

   if (response.statusCode != 200) {
    return callback(response.statusMessage, null);
   }

   log(API_BODY_LEVEL, "\nBody: " + JSON.stringify(body));
   log(API_RESPONSE_LEVEL, "\nResponse: " + JSON.stringify(response));

   try {
    body = body.response;

    callback(null, body);
   } catch (e) {
    log(API_ERR_LEVEL, "Error parsing solarStatus response");
    callback(e, null);
   }

   log(API_RETURN_LEVEL, "\nGET request: " + "/solarStatus" + " completed.");
  });
request(npm)ResponsestatusMessage

Most used request functions

  • request
  • Response.statusCode
  • RequestAPI.post
  • RequestAPI.get
  • Request.pipe
  • rp,
  • Request.on,
  • Response.headers,
  • RequestAPI.defaults,
  • RequestAPI.put,
  • RequestAPI.jar,
  • Response.statusMessage,
  • RequestAPI.head,
  • Response.on,
  • RequestAPI.cookie,
  • RequestAPI.delete,
  • Response.pipe,
  • RequestAPI.del,
  • requestRetry

Popular in JavaScript

  • glob
    a little globber
  • minimatch
    a glob matcher in javascript
  • yargs
    yargs the modern, pirate-themed, successor to optimist.
  • path
  • q
    A library for promises (CommonJS/Promises/A,B,D)
  • request
    Simplified HTTP request client.
  • mocha
    simple, flexible, fun test framework
  • fs
  • moment
    Parse, validate, manipulate, and display dates
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJavascript Code Index
Get Tabnine for your IDE now