Comparing version 5.0.0 to 6.0.0
{ | ||
"name": "bent", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Functional HTTP client for Node.js w/ async/await.", | ||
"main": "index.js", | ||
"main": "src/nodejs.js", | ||
"browser": "src/browser.js", | ||
"scripts": { | ||
"commit": "git-cz", | ||
"test": "tap tests/test-*.js --100", | ||
"posttest": "standard", | ||
"precommit": "npm test", | ||
"prepush": "npm test", | ||
"commitmsg": "validate-commit-msg", | ||
"semantic-release": "semantic-release" | ||
"test": "nyc --check-coverage --branches 100 --functions 100 --lines 100 aegir test -t node browser", | ||
"pretest": "aegir lint" | ||
}, | ||
@@ -19,16 +15,9 @@ "keywords": [], | ||
"dependencies": { | ||
"bl": "^2.1.2", | ||
"caseless": "^0.12.0", | ||
"is-stream": "^1.1.0" | ||
"caseless": "~0.12.0", | ||
"is-stream": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^16.2.3", | ||
"budo": "^10.0.4", | ||
"codecov": "^3.0.0", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"husky": "^1.3.1", | ||
"semantic-release": "^15.13.1", | ||
"standard": "^10.0.3", | ||
"tap": "^12.5.0", | ||
"validate-commit-msg": "^2.14.0" | ||
"aegir": "^20.0.0", | ||
"nyc": "^14.1.1", | ||
"tsame": "^2.0.1" | ||
}, | ||
@@ -35,0 +24,0 @@ "repository": { |
@@ -5,2 +5,4 @@ # bent | ||
*Incredibly small browser version built on fetch w/ no external dependencies or polyfills.* | ||
## Usage | ||
@@ -15,3 +17,3 @@ | ||
let obj = await getJSON('http://site.com/json.api') | ||
let buffer = await getBuffer('http//site.com/image.png') | ||
let buffer = await getBuffer('http://site.com/image.png') | ||
``` | ||
@@ -24,4 +26,10 @@ | ||
You can provide these options in any order, and Bent will figure out which option is which by inspecting the option's type and content. | ||
```javascript | ||
const post = bent('http://localhost:3000/', 'POST', 'json', 200); | ||
const response = await post('cars/new', {name: 'bmw', wheels: 4}); | ||
``` | ||
If you don't set a response encoding (`'json'`, `'string'` or `'buffer'`) | ||
then the response stream will be returned after the statusCode check. | ||
then the response object will be returned after the statusCode check. | ||
@@ -38,12 +46,13 @@ ```javascript | ||
* **HTTP Method**: `'GET'`, `'PUT'`, and any ALLCAPS string will be | ||
used to set the HTTP method. Defaults to `'GET'` | ||
* **Response Encoding**: Available options are `'string'`, `'buffer'`, and | ||
`'json'`. If no encoding is set, which is the default, the response | ||
object/stream will be returned instead of a decoded response. | ||
* **Status Codes**: Any number will be considered an acceptable status code. If none are provided `200` will be the only acceptable status code, but | ||
if status codes are provided `200` must be added explicitely. | ||
* **HTTP Method**: `'GET'`, `'PUT'`, or any other ALLCAPS string will be | ||
used to set the HTTP method. Defaults to `'GET'`. | ||
* **Response Format**: Available formats are `'string'`, `'buffer'`, and | ||
`'json'`. By default, the response object/stream will be returned instead | ||
of a decoded response. *Browser returns `ArrayBuffer` instead of `Buffer`.* | ||
* **Status Codes**: Any number will be considered an acceptable status code. | ||
By default, `200` is the only acceptable status code. When any status codes | ||
are provided, `200` must be included explicitly in order to be acceptable. | ||
* **Headers**: An object can be passed to set request headers. | ||
* **Base URL**: Any string that begins with 'https:' or 'http:' is | ||
consider the Base URL. Subsequent queries need only pass the remaining | ||
considered the Base URL. Subsequent queries need only pass the remaining | ||
URL string. | ||
@@ -53,2 +62,5 @@ | ||
When working with Binary this library uses different types in the browser and Node.js. In Node.js all binary must be done | ||
the `Buffer` type. In the browser you can use ArrayBuffer or any ArrayBuffer view type (UInt8Array, etc). | ||
### `async request(url[, body=null])` | ||
@@ -58,3 +70,4 @@ | ||
base URL is passed the remaining URL string. | ||
* **body**: Request body. Can be stream, buffer or JSON object. | ||
* **body**: Request body. Can be a string, a stream (node.js), a buffer (node.js), | ||
an ArrayBuffer (browser), or a JSON object. | ||
@@ -61,0 +74,0 @@ ```javascript |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
2
3
376
74
0
14710
8
+ Addedis-stream@2.0.1(transitive)
- Removedbl@^2.1.2
- Removedbl@2.2.1(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedsafe-buffer@5.1.25.2.1(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedcaseless@~0.12.0
Updatedis-stream@^2.0.0