dhttp

Just another biased browserify-compatible HTTP/HTTPS wrapper

Not maintained, don't use this
Last updated 2 years ago by dcousens .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install dhttp 
SYNC missed versions from official npm registry.

dhttp

TRAVIS NPM

js-standard-style

Just another biased browserify-compatible HTTP/HTTPS/XHR wrapper. No compatability with IE.

Automatically parses application/json, text/(plain|html) and application/octet-stream.

Example

let dhttp = require('dhttp')

// ...
dhttp({
  method: 'GET',
  url: 'http://localhost:8000'
}, function (err, res) {
  // err is only provided if the connection failed in some way
  // OR if the content body parsing failed in some way
  if (err) return
  if (res.statusCode !== 200) return
  if (res.headers['content-type'] !== 'application/json') return

  // if `content-type` was not supported, expect body to be `null`
  console.log(res.body)
  // => { foo: 'bar' }, a parsed JSON object

  // ...
})

To bypass statusCode handling, you can use dhttp/200 which throws a descriptive error for any statusCode other than 200 using http-status-codes.

let dhttp = require('dhttp/200')
// ...

LICENSE MIT

Current Tags

  • 3.0.3                                ...           latest (2 years ago)

37 Versions

  • 3.0.3 [deprecated]           ...           2 years ago
  • 3.0.2 [deprecated]           ...           2 years ago
  • 3.0.1 [deprecated]           ...           2 years ago
  • 3.0.0 [deprecated]           ...           2 years ago
  • 2.5.0 [deprecated]           ...           2 years ago
  • 2.4.2 [deprecated]           ...           3 years ago
  • 2.4.1 [deprecated]           ...           3 years ago
  • 2.4.0 [deprecated]           ...           3 years ago
  • 2.3.6 [deprecated]           ...           3 years ago
  • 2.3.5 [deprecated]           ...           3 years ago
  • 2.3.4 [deprecated]           ...           3 years ago
  • 2.3.3 [deprecated]           ...           4 years ago
  • 2.3.2 [deprecated]           ...           4 years ago
  • 2.3.1 [deprecated]           ...           4 years ago
  • 2.3.0 [deprecated]           ...           4 years ago
  • 2.2.1 [deprecated]           ...           4 years ago
  • 2.2.0 [deprecated]           ...           4 years ago
  • 2.1.1 [deprecated]           ...           4 years ago
  • 2.1.0 [deprecated]           ...           4 years ago
  • 2.0.8 [deprecated]           ...           4 years ago
  • 2.0.7 [deprecated]           ...           4 years ago
  • 2.0.6 [deprecated]           ...           4 years ago
  • 2.0.5 [deprecated]           ...           4 years ago
  • 2.0.4 [deprecated]           ...           4 years ago
  • 2.0.3 [deprecated]           ...           4 years ago
  • 2.0.2 [deprecated]           ...           4 years ago
  • 2.0.1 [deprecated]           ...           4 years ago
  • 2.0.0 [deprecated]           ...           4 years ago
  • 2.0.0-rc2                                ...           4 years ago
  • 2.0.0-rc1                                ...           4 years ago
  • 1.0.8 [deprecated]           ...           5 years ago
  • 1.0.7 [deprecated]           ...           5 years ago
  • 1.0.5 [deprecated]           ...           5 years ago
  • 1.0.4 [deprecated]           ...           5 years ago
  • 1.0.3 [deprecated]           ...           5 years ago
  • 1.0.2 [deprecated]           ...           5 years ago
  • 1.0.1 [deprecated]           ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 1
Last Month 3
Dependencies (1)
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |