How to use the tiny-json-http.put 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 / _unlock.js View on Github external
function _status(headers) {
        headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
        tiny.put({
          url,
          headers,
        }, function done(err, response) {
          if (err) {
            console.log(err)
          }
          else {
            callback(response.body, headers)
          }
        })
      }
    )
github ryanblock / august-connect / src / _unlock.js View on Github external
function pickTheLock(data, headers) {
        let locks = Object.keys(data)
        // Make sure we never, ever lock or unlock the wrong lock
        if (locks.length > 1) {
          throw Error('If you own multiple locks, you must specify which lock to lock.')
        }
        lockID = locks[0]
        const url = 'https://api-production.august.com/remoteoperate/' + lockID + '/unlock'
        headers['Content-Length'] = 0
        tiny.put({
          url,
          headers,
        }, function done(err, response) {
          if (err) {
            console.log(err)
          }
          else {
            callback(response.body, headers)
          }
        })
      }
    )
github ryanblock / august-connect / src / _status.js View on Github external
function _status(headers) {
        headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
        tiny.put({
          url,
          headers,
        }, function done(err, response) {
          if (err) {
            console.log(err)
          }
          else {
            callback(response.body, headers)
          }
        })
      }
    )
github ryanblock / august-connect / src / _lock.js View on Github external
function _status(headers) {
        headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
        tiny.put({
          url,
          headers
        }, function done(err, response) {
          if (err) {
            console.log(err)
          }
          else {
            callback(response.body, headers)
          }
        })
      }
    )
github ryanblock / august-connect / src / _lock.js View on Github external
function pickTheLock(data, headers) {
        let locks = Object.keys(data)
        // Make sure we never, ever lock or unlock the wrong lock
        if (locks.length > 1) {
          throw Error('If you own multiple locks, you must specify which lock to lock.')
        }
        else {
          lockID = locks[0]
          let statusEndpoint = 'https://api-production.august.com/remoteoperate/' + lockID + '/lock'
          headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
          tiny.put({
            url: statusEndpoint,
            headers
          }, function done(err, response) {
            if (err) {
              console.log(err)
            }
            else {
              callback(response.body, headers)
            }
          })
        }
      }
    )
github ryanblock / august-connect / src / _status.js View on Github external
function pickTheLock(data, headers) {
        // TODO maybe enable this method to return status of all locks?
        const locks = Object.keys(data)
        lockID = locks[0]
        const url = 'https://api-production.august.com/remoteoperate/' + lockID + '/status'
        headers['Content-Length'] = 0 // endpoint requires `Content-length: 0` or it won't hang up ¯\_(ツ)_/¯
        tiny.put({
          url,
          headers,
        }, function done(err, response) {
          if (err) {
            console.log(err)
          }
          else {
            callback(response.body, headers)
          }
        })
      }
    )

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