0.2.13 • Published 6 years ago
tinyget v0.2.13
tinyget
A tiny http client for nodejs & browser
Installation
$ npm install tinyget --save
Or, via webmodules
$ wpm install tinyget --save
Or, via bower
$ bower install tinyget --save
Usage
Node.js (commonjs)
var tinyget = require('tinyget');
Browser (global)
var tinyget = window.TinyGet;
Example
// default is get
tinyget('/path/file').qry({key: value}).exec(function(err, result) {
// TODO
});
// get, post, put, delete, options
tinyget.post('/path/file').payload({key:'value'}).exec(function(err, result) {
// TODO
});
// alt style 1
tinyget({
url: '/path/file',
payload: {key:'value'}
}).exec(function(err, result) {
// TODO
});
tinyget.post({
url: '/path/file',
contentType: 'application/json',
evalType: 'json',
payload: {key:'value'}
}).exec(function(err, result) {
// TODO
});
// alt style 2
tinyget({
url: '/path/file',
payload: {key:'value'}
}, function(err, result) {
// TODO
});
tinyget.put({
url: '/path/file',
payload: {key:'value'}
}, function(err, result) {
// TODO
});
Options
- options : url string or object
- url: remote url(string), required.
- payload: payload (string/object), default is null.
- qry: query string (string/object), default is null.
- contentType: request content-type (string), default when payload is object
application/json
elsetext/form-url-encoded
- responseType: xhr.responseType(xhr2) (string), default is null
- type: response object eval type
text, json, xml
(string), default isauto
- headers: request headers (object), default is null.
- sync: sync request (boolean), default is false
License
Licensed under the MIT License. See LICENSE for the full license text.
0.2.13
6 years ago
0.2.12
6 years ago
0.2.11
6 years ago
0.2.10
6 years ago
0.2.9
7 years ago
0.2.8
7 years ago
0.2.7
7 years ago
0.2.6
7 years ago
0.2.5
7 years ago
0.2.4
7 years ago
0.2.3
7 years ago
0.2.2
7 years ago
0.2.1
7 years ago
0.2.0
7 years ago
0.1.12
7 years ago
0.1.11
7 years ago
0.1.10
7 years ago
0.1.9
7 years ago
0.1.8
7 years ago
0.1.7
7 years ago
0.1.6
7 years ago
0.1.5
7 years ago
0.1.4
7 years ago
0.1.3
7 years ago
0.1.2
7 years ago
0.1.1
8 years ago
0.1.0
8 years ago
0.0.11
8 years ago
0.0.10
8 years ago
0.0.9
8 years ago
0.0.8
8 years ago
0.0.7
8 years ago
0.0.6
8 years ago
0.0.5
8 years ago
0.0.4
8 years ago
0.0.3
8 years ago
0.0.2
8 years ago
0.0.1
8 years ago
0.0.0
8 years ago