How to use the simple-get.post function in simple-get

To help you get started, we’ve selected a few simple-get 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 isomorphic-git / isomorphic-git / __tests__ / __helpers__ / karma-pr-comment-reporter.js View on Github external
const isPR =
    (process.env.TRAVIS_PULL_REQUEST &&
      process.env.TRAVIS_PULL_REQUEST !== 'false') ||
    process.env.BUILD_REASON === 'PullRequest'
  const repo = process.env.TRAVIS_REPO_SLUG || process.env.BUILD_REPOSITORY_NAME
  const issue =
    process.env.TRAVIS_PULL_REQUEST ||
    process.env.SYSTEM_PULLREQUEST_PULLREQUESTNUMBER ||
    process.env.SYSTEM_PULLREQUEST_PULLREQUESTID
  console.log(message)
  console.log(`Detected repo: ${repo}, issue: #${issue}, is PR: ${isPR}\n`)
  if (isPR) {
    // comment(process.env.KARMA_PR_REPORTER_GITHUB_TOKEN, repo, issue, message)
    // .then(response => console.log(`posted results to PR #${issue}`))
    // .catch(err => console.log('error leaving Github comment:', err))
    fetch.post(
      {
        url: 'https://karma-pr-reporter.glitch.me',
        body: JSON.stringify({ repo, issue, message })
      },
      (err, res) => {
        if (err) return console.log('error leaving Github comment:', err)
        console.log(res.body)
      }
    )
  } else {
    console.log('not leaving a Github comment')
  }
}
github webtorrent / webtorrent-desktop / src / renderer / lib / telemetry.js View on Github external
if (!config.IS_PRODUCTION) {
    // Development: telemetry used only for local debugging
    // Empty uncaught errors, etc at the start of every run
    return reset()
  }

  const get = require('simple-get')

  const opts = {
    url: config.TELEMETRY_URL,
    body: telemetry,
    json: true
  }

  get.post(opts, function (err, res) {
    if (err) return console.error('Error sending telemetry', err)
    if (res.statusCode !== 200) {
      return console.error(`Error sending telemetry, status code: ${res.statusCode}`)
    }
    console.log('Sent telemetry')
    reset()
  })
}

simple-get

Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis