@mainframe/transport-create-http
HTTP transport factory
Last updated 2 years ago by paul_lecam .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @mainframe/transport-create-http 
SYNC missed versions from official npm registry.

transport-create-http

HTTP transport factory used by transport-http-browser and transport-http-node.

Throws HTTPError when the request fails.

Installation

yarn add @mainframe/transport-create-http

Usage

import createTransport from '@mainframe/transport-create-http'

const request = createTransport(window.fetch)('http://localhost')

request({ hello: 'transport' }).then(console.log)

API

createTransport() (default export)

Arguments

  1. fetch: (req: Request) => Response: function implementing the Fetch interfaces.

Returns (data: Object) => Promise<any>

HTTPError class

Arguments

  1. status: number: HTTP status code
  2. message: string: error message

Properties

  • status: number: HTTP status code
  • message: string: error message

License

MIT

Current Tags

  • 0.1.2                                ...           latest (2 years ago)

3 Versions

  • 0.1.2                                ...           2 years ago
  • 0.1.1                                ...           2 years ago
  • 0.1.0                                ...           3 years ago
Downloads
Today 0
This Week 1
This Month 4
Last Day 0
Last Week 0
Last Month 3
Dependencies (1)
Dev Dependencies (1)

Copyright 2014 - 2016 © taobao.org |