0.0.5 • Published 7 years ago

@slicky/http v0.0.5

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

NPM version

Slicky/HTTP

Super simple (but advanced) ajax reactive library. Using RxJS. Supports sending files.

Installation

$ npm install @slicky/http

Usage

import {Http} from '@slicky/http';

const http = new Http;
const data = {number: 5};
const options = {};

http.request('/users', 'GET', data, options).subscribe((response) => {
	console.log(response.json());
});

Shortcuts

http.get('/api', data, options).subscribe((response) => {});
http.post('/api', data, options).subscribe((response) => {});
http.files('/api', filesList, data, options).subscribe((response) => {});

Options

  • jsonp: name of callback for jsonp requests, when true is given callback name is used. Default is false
  • jsonPrefix: prefix for json requests. Read more here. Default is null
  • mimeType: Default is null
  • headers: List of headers to be send to server. Default is {}
  • files: List of files to be send to server. Default is []

Queue

By default all your requests are called from queue one by one, so there is always just one request running (or zero). Inspiration is from this article http://blog.alexmaccaw.com/queuing-ajax-requests.

You can disable this feature with ImmediateQueue:

import {Http, ImmediateQueue} from '@slicky/http';

const http = new Http({
	queue: new ImmediateQueue
});

Known limitations

  • All non ASCII chars (eg. letters with diacritics) in file names are converted to ASCII chars before uploading.
0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago