How to use the tiny-json-http.get function in tiny-json-http

To help you get started, we’ve selected a few tiny-json-http 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 ryanblock / august-connect / src / _locks.js View on Github external
function _locks(headers) {
      headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
      tiny.get({
        url,
        headers
      }, function done(err, response) {
        if (err) {
          console.log(err)
        }
        else {
          callback(response.body, headers)
        }
      })
    }
  )
github architect / architect / test / slow / sandbox / 00-html.js View on Github external
test('can read /', t=> {
  t.plan(2)
  tiny.get({
    url: `http://localhost:${port}/`
  },
  function _got(err, data) {
    if (err) {
      t.fail(err)
      console.log(err)
    }
    else {
      t.ok(true, 'got /')
      t.equals('hello world', data.body, 'is hello world')
      console.log({data})
    }
  })
})
github architect / architect / test / slow / sandbox / 01-json.js View on Github external
test('can read /api', t=> {
  t.plan(2)
  tiny.get({
    url: `http://localhost:${port}/api`
  },
  function _got(err, data) {
    if (err) {
      t.fail(err)
      console.log(err)
    }
    else {
      t.ok(true, 'got /')
      t.equals('world', data.body.hello, 'is hello world')
      console.log(data)
    }
  })
})

tiny-json-http

Minimalist `HTTP` client for `GET`, `POST`, `PUT`, `PATCH` and `DELETE` `JSON` payloads

Apache-2.0
Latest version published 1 year ago

Package Health Score

54 / 100
Full package analysis

Similar packages