Socket
Socket
Sign inDemoInstall

bent

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bent - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

.github/main.workflow

31

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc