Comparing version 13.0.3 to 14.0.0
@@ -0,0 +0,0 @@ 'use strict'; |
@@ -32,3 +32,3 @@ 'use strict'; | ||
return this.emit('error', Boom.badRequest('Payload content length greater than maximum allowed: ' + this.settings.maxBytes)); | ||
return this.emit('error', Boom.entityTooLarge('Payload content length greater than maximum allowed: ' + this.settings.maxBytes)); | ||
} | ||
@@ -35,0 +35,0 @@ |
{ | ||
"name": "wreck", | ||
"description": "HTTP Client Utilities", | ||
"version": "13.0.3", | ||
"version": "14.0.0", | ||
"repository": "git://github.com/hapijs/wreck", | ||
@@ -21,5 +21,8 @@ "main": "lib/index", | ||
"code": "5.x.x", | ||
"eslint-plugin-markdown": "1.0.0-beta.6", | ||
"lab": "14.x.x" | ||
}, | ||
"scripts": { | ||
"lint-md": "eslint --config hapi --parser-options=ecmaVersion:8 --rule 'strict: 0, eol-last: 0' --plugin markdown --ext md .", | ||
"posttest": "npm run lint-md", | ||
"test": "lab -t 100 -L -a code", | ||
@@ -26,0 +29,0 @@ "test-cov-html": "lab -r html -o coverage.html -a code" |
@@ -13,18 +13,24 @@ ![wreck Logo](https://raw.github.com/hapijs/wreck/master/images/wreck.png) | ||
<!-- eslint-disable no-undef --> | ||
<!-- eslint-disable no-unused-vars --> | ||
```javascript | ||
const Wreck = require('wreck'); | ||
async function example () { | ||
const { res, payload } = await Wreck.get('http://example.com'); | ||
console.log(payload.toString()); | ||
} | ||
const example = async function () { | ||
const { res, payload } = await Wreck.get('http://example.com'); | ||
console.log(payload.toString()); | ||
}; | ||
try { | ||
example(); | ||
} catch (ex) { | ||
console.error(ex); | ||
example(); | ||
} | ||
catch (ex) { | ||
console.error(ex); | ||
} | ||
``` | ||
### Advanced | ||
<!-- eslint-disable no-undef --> | ||
<!-- eslint-disable no-unused-vars --> | ||
```javascript | ||
@@ -58,3 +64,3 @@ const Wreck = require('wreck'); | ||
redirects: 3, | ||
beforeRedirect: function (redirectMethod, statusCode, location, resHeaders, redirectOptions, next) { return next() }, | ||
beforeRedirect: (redirectMethod, statusCode, location, resHeaders, redirectOptions, next) => next(), | ||
redirected: function (statusCode, location, req) {}, | ||
@@ -70,10 +76,14 @@ timeout: 1000, // 1 second, default: unlimited | ||
const promise = wreck.request(method, uri, options); | ||
try { | ||
const res = await promise; | ||
const body = await Wreck.read(res); | ||
} | ||
catch (err) { | ||
// Handle errors | ||
} | ||
const example = async function () { | ||
const promise = wreck.request(method, uri, options); | ||
try { | ||
const res = await promise; | ||
const body = await Wreck.read(res); | ||
console.log(body.toString()); | ||
} | ||
catch (err) { | ||
// Handle errors | ||
} | ||
}; | ||
``` | ||
@@ -130,3 +140,3 @@ | ||
for possible [SSL_METHODS](http://www.openssl.org/docs/ssl/ssl.html#DEALING_WITH_PROTOCOL_METHODS). | ||
- `ciphers` - [TLS](https://nodejs.org/api/tls.html#tls_modifying_the_default_tls_cipher_suite) list of TLS ciphers to override node's default. | ||
- `ciphers` - [TLS](https://nodejs.org/api/tls.html#tls_modifying_the_default_tls_cipher_suite) list of TLS ciphers to override node's default. | ||
The possible values depend on your installation of OpenSSL. Read the official OpenSSL docs | ||
@@ -266,2 +276,4 @@ for possible [TLS_CIPHERS](https://www.openssl.org/docs/man1.0.2/apps/ciphers.html#CIPHER-LIST-FORMAT). | ||
<!-- eslint-disable no-unused-vars --> | ||
<!-- eslint-disable no-undef --> | ||
```javascript | ||
@@ -280,2 +292,4 @@ const stream = Wreck.toReadableStream(new Buffer('Hello', 'ascii'), 'ascii'); | ||
<!-- eslint-disable no-unused-vars --> | ||
<!-- eslint-disable no-undef --> | ||
```javascript | ||
@@ -308,2 +322,3 @@ const result = Wreck.parseCacheControl('private, max-age=0, no-cache'); | ||
<!-- eslint-disable no-undef --> | ||
```js | ||
@@ -310,0 +325,0 @@ const HTTPS = require('https'); |
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
40729
367
3