fluent-http
v1.1.0
Published
Simple fluent API http client for browser
Downloads
21
Readme
fluent-http
Usage
npm install fluent-http
Script tag
// HTML
<script src="node_modules/fluent-http/dist/fluent-http.js"></script>
// JS
window.fluentHttp
CommonJS
const fluentHttp = require('fluent-http')
ES6 import
import { Http } from 'fluent-http'
Examples
const client = new fluentHttp.Http()
client.withUrl('https://google.com')
.request()
.then((response) => {
console.log(response)
})
class BasicAuthInterceptor extends fluentHttp.Interceptor { ... }
const client = new fluentHttp.Http()
client.asPost()
.withUrl('/api/create')
.withInterceptor(new BasicAuthInterceptor(user, pass))
.withData(fluentHttp.Body.asJson(someData))
.request()
.then((response) => {
console.log(response)
})
Development
Tests
- Mock package: fetch-mock