How to use the request-promise.post function in request-promise

To help you get started, we’ve selected a few request-promise 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 tamarasaurus / immo-feed / scraper / src / notification / slack.ts View on Github external
export default function notify(updatedRecords: any[]) {
    const url = process.env.SLACK_WEBHOOK_URL

    if (!url || url.length === 0) throw Error('You have to specify the SLACK_WEBHOOK_URL in your environment variables')

    return request.post(url, {
        json: {
            channel: '#immo-feed',
            username: 'immo-feed',
            text: `:house: ${updatedRecords.length} new result(s) found`,
            icon_emoji: ':house:'
        }
    })
    .then(() => console.log('🔔  Slack notification sent'))
    .catch(err => console.log('🔔  Slack notification failed'))
}
github parse-community / parse-server / spec / JobSchedule.spec.js View on Github external
it('should fail creating a job with an invalid name', (done) => {
    const options = Object.assign({}, masterKeyOptions, {
      body: {
        job_schedule: {
          jobName: 'job'
        }
      }
    });
    rp.post(Parse.serverURL + '/cloud_code/jobs', options)
      .then(done.fail)
      .catch(() => done());
  });
github otiai10 / kanColleWidget / scripts / publish.js View on Github external
function refreshAccessToken(client_id, client_secret, refresh_token) {
  return request.post("https://www.googleapis.com/oauth2/v4/token", {
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    form: {
      client_id: client_id,
      client_secret: client_secret,
      refresh_token: refresh_token,
      grant_type: "refresh_token",
    }
  });
}
github kelvien / vscode-hue / src / hue / huetility.ts View on Github external
createNewUser() {
    return RP.post(this.baseUrl, {
      json: true,
      body: {
          devicetype: `VSCodeExtension#Hue`
        }
      }).then(HandleSuccessResponse);
  }
}

request-promise

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.

ISC
Latest version published 4 years ago

Package Health Score

55 / 100
Full package analysis