Comparing version 0.0.4 to 0.0.5
@@ -474,2 +474,8 @@ /** | ||
* Alias for _.header_ | ||
* @type {Function} | ||
*/ | ||
$this.headers = $this.header; | ||
/** | ||
* Alias for _.header_ | ||
* | ||
@@ -679,2 +685,3 @@ * @type {Function} | ||
Unirest.cookie = Unirest.request.cookie; | ||
Unirest.pipe = Unirest.request.pipe; | ||
@@ -707,3 +714,3 @@ /** | ||
options: [ | ||
'uri:url', 'redirects:maxRedirects', 'redirect:followRedirect', 'url', 'headers', 'method', 'qs', 'form', 'json', 'multipart', | ||
'uri:url', 'redirects:maxRedirects', 'redirect:followRedirect', 'url', 'method', 'qs', 'form', 'json', 'multipart', | ||
'followRedirect', 'followAllRedirects', 'maxRedirects', 'encoding', 'pool', 'timeout', 'proxy', 'oauth', 'hawk', | ||
@@ -710,0 +717,0 @@ 'ssl:strictSSL', 'strictSSL', 'jar', 'cookies:jar', 'aws', 'httpSignature', 'localAddress', 'ip:localAddress' |
{ | ||
"name": "unirest", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Lightweight HTTP Request library.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -61,3 +61,3 @@ # Unirest for Node.js [![Build Status](https://travis-ci.org/Mashape/unirest-nodejs.png?branch=master)](https://travis-ci.org/Mashape/unirest-nodejs) | ||
## unirest(method [, uri]) | ||
## unirest(method [, uri, headers, body, callback]) | ||
@@ -67,9 +67,18 @@ - `method` - Request type (GET, PUT, POST, etc...) | ||
Otherwise it will return the method below with `method` set to the method given. | ||
- `headers` (`Object`) - _Optional_; Will be aliased to unirest\[method] `headers` argument when `uri` is present. | ||
- `body` (`Mixed`) - _Optional_; Will be aliased to unirest\[method] `body` argument when `uri` is present. | ||
- `callback` (`Function`) - _Optional_; Will be aliased to unirest\[method] `callback` argument when `uri` is present. | ||
## unirest\[method](url [, callback]) | ||
## unirest\[method](url [, headers, body, callback]) | ||
- `method` - Request type, pre-defined methods, see below. | ||
- `url` - Request location. | ||
- `callback` - _Optional_; | ||
- `headers` (`Object` | `Function`) - _Optional_; When `Object` headers are passed along to the `Request.set()` method, | ||
when `Function` this argument is used as the `callback`. | ||
- `body` (`Mixed` | `Function`) - _Optional_; When `body` is not a `Function` it will be passed along to `Request.send()` method, | ||
otherwise when a `Function` it will be used as the `callback`. | ||
- `callback` (`Function`) - _Optional_; Calls end with given argument, otherwise `Request` is returned. | ||
All arguments above, with the exclusion of `url`, will accept a `Function` as the `callback`. | ||
When no `callback` is present, the [Request](#request) object will be returned. | ||
@@ -389,13 +398,2 @@ ### get | ||
#### Request.headers(Object) | ||
Sets `headers` object on `Request.options` to the given object. | ||
```js | ||
Request.headers({ | ||
'Accepts': 'application/json', | ||
'Content-Type': 'application/json' | ||
}); | ||
``` | ||
#### Request.form(Object) | ||
@@ -573,2 +571,6 @@ | ||
#### Request.headers | ||
**Alias** for `Request.header()` | ||
#### Request.redirects | ||
@@ -575,0 +577,0 @@ |
@@ -46,12 +46,2 @@ var should = require("should"); | ||
it('should correctly handle cookie data.', function (done) { | ||
var CookieJar = unirest.jar(); | ||
CookieJar.add(unirest.cookie('another cookie=23')); | ||
unirest.get('http://google.com').jar(CookieJar).end(function (response) { | ||
response.cookie('another cookie').should.exist; | ||
done(); | ||
}); | ||
}); | ||
it('should be able to look like unirest-php', function (done) { | ||
@@ -58,0 +48,0 @@ unirest.get('http://httpbin.org/gzip', { 'Accept': 'gzip' }, 'Hello World', function (response) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45236
653
764