Comparing version 0.2.6 to 0.2.7
@@ -431,7 +431,5 @@ /** | ||
if (does(item.value).contain('http://') || does(item.value).contain('https://')) { | ||
item.value = Unirest.require(item.value); | ||
} else if (does(item.value).contain('://')) { | ||
item.value = fs.createReadStream(item.value); | ||
item.value = Unirest.request(item.value); | ||
} else { | ||
item.value = fs.createReadStream(path.join(__dirname, item.value)); | ||
item.value = fs.createReadStream(path.resolve(item.value)); | ||
} | ||
@@ -438,0 +436,0 @@ } |
{ | ||
"name": "unirest", | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"description": "Lightweight HTTP Request library.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,4 +11,4 @@ # Unirest for Node.js [![Build Status](https://travis-ci.org/Mashape/unirest-nodejs.png?branch=master)](https://travis-ci.org/Mashape/unirest-nodejs) | ||
```js | ||
npm install unirest | ||
```bash | ||
$ npm install unirest | ||
``` | ||
@@ -183,3 +183,3 @@ | ||
``` | ||
```js | ||
Request.auth('Nijiko', 'insecure', true); | ||
@@ -202,4 +202,4 @@ ``` | ||
Request.set({ | ||
'Accepts': 'application/json' | ||
, 'User-Agent': 'Unirest Node.js' | ||
'Accepts': 'application/json', | ||
'User-Agent': 'Unirest Node.js' | ||
}) | ||
@@ -210,3 +210,3 @@ ``` | ||
``` | ||
```js | ||
Request.set('Accepts', 'application/json'); | ||
@@ -225,7 +225,7 @@ ``` | ||
Request.part({ | ||
'content-type': 'application/json' | ||
, body: { foo: 'bar' } | ||
'content-type': 'application/json', | ||
body: { foo: 'bar' } | ||
}).part({ | ||
'content-type': 'text/html' | ||
, body: '<strong>Hello World!</strong>' | ||
'content-type': 'text/html', | ||
body: '<strong>Hello World!</strong>' | ||
}); | ||
@@ -315,3 +315,3 @@ ``` | ||
- `name` (`String`) - File field name | ||
- `path` (`String` | `Object`) - File value, A `String` will be parsed based on its value. If `path` contains `http` or `https` Request will handle it as a `remote file`, otherwise if it contains `://` and not `http` or `https` it will consider it to be a `direct file path`. If no `://` is found it will be considered a `relative file path`. An `Object` is directly set, so you can do pre-processing if you want without worrying about the string value. | ||
- `path` (`String` | `Object`) - File value, A `String` will be parsed based on its value. If `path` contains `http` or `https` Request will handle it as a `remote file`. If `path` does not contain `http` or `https` then unirest will assume that it is the path to a local file and attempt to find it using `path.resolve`. An `Object` is directly set, so you can do pre-processing if you want without worrying about the string value. | ||
@@ -327,5 +327,5 @@ **Object** | ||
.attach({ | ||
'file': 'dog.png' | ||
, 'relative file': fs.createReadStream(path.join(__dirname, 'dog.png'), | ||
, 'remote file': unirest.request('http://google.com/doodle.png') | ||
'file': 'dog.png', | ||
'relative file': fs.createReadStream(path.join(__dirname, 'dog.png'), | ||
'remote file': unirest.request('http://google.com/doodle.png') | ||
}) | ||
@@ -429,9 +429,9 @@ .end(function (response) { | ||
Request.multipart([{ | ||
'content-type': 'application/json' | ||
, body: JSON.stringify({ | ||
'content-type': 'application/json', | ||
body: JSON.stringify({ | ||
foo: 'bar' | ||
}) | ||
}, { | ||
'content-type': 'text/html' | ||
, body: '<strong>Hello World!</strong>' | ||
'content-type': 'text/html', | ||
body: '<strong>Hello World!</strong>' | ||
}]); | ||
@@ -510,5 +510,5 @@ ``` | ||
Request.aws({ | ||
key: 'AWS_S3_KEY' | ||
, secret: 'AWS_S3_SECRET' | ||
, bucket: 'BUCKET NAME' | ||
key: 'AWS_S3_KEY', | ||
secret: 'AWS_S3_SECRET', | ||
bucket: 'BUCKET NAME' | ||
}); | ||
@@ -525,5 +525,5 @@ ``` | ||
Request.oauth({ | ||
callback: 'http://mysite.com/callback/' | ||
, consumer_key: 'CONSUMER_KEY' | ||
, consumer_secret: 'CONSUMER_SECRET' | ||
callback: 'http://mysite.com/callback/', | ||
consumer_key: 'CONSUMER_KEY', | ||
consumer_secret: 'CONSUMER_SECRET' | ||
}).end(function (response) { | ||
@@ -534,6 +534,6 @@ var access_token = response.body; | ||
Request.oauth({ | ||
consumer_key: 'CONSUMER_KEY' | ||
, consumer_secret: 'CONSUMER_SECRET' | ||
, token: access_token.oauth_token | ||
, verifier: token: access_token.oauth_verifier | ||
consumer_key: 'CONSUMER_KEY', | ||
consumer_secret: 'CONSUMER_SECRET', | ||
token: access_token.oauth_token, | ||
verifier: token: access_token.oauth_verifier | ||
}).end(function (response) { | ||
@@ -544,9 +544,9 @@ var token = response.body; | ||
Request.oauth({ | ||
consumer_key: 'CONSUMER_KEY' | ||
, consumer_secret: 'CONSUMER_SECRET' | ||
, token: token.oauth_token | ||
, token_secret: token.oauth_token_secret | ||
consumer_key: 'CONSUMER_KEY', | ||
consumer_secret: 'CONSUMER_SECRET', | ||
token: token.oauth_token, | ||
token_secret: token.oauth_token_secret | ||
}).query({ | ||
screen_name: token.screen_name | ||
, user_id: token.user_id | ||
screen_name: token.screen_name, | ||
user_id: token.user_id | ||
}).end(function (response) { | ||
@@ -568,5 +568,5 @@ console.log(response.body); | ||
credentials: { | ||
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn' | ||
, algorithm: 'sha256' | ||
, user: 'Steve' | ||
key: 'werxhqb98rpaxn39848xrunpaw3489ruxnpa98w4rxn', | ||
algorithm: 'sha256', | ||
user: 'Steve' | ||
} | ||
@@ -573,0 +573,0 @@ }); |
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
47022
792