node-fetch
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -5,2 +5,10 @@ | ||
# 1.x release | ||
## v1.0.0 | ||
- Enhance: better test coverage and doc | ||
# 0.x release | ||
@@ -7,0 +15,0 @@ |
@@ -5,3 +5,3 @@ | ||
*As of 0.x release* | ||
*As of 1.x release* | ||
@@ -18,2 +18,4 @@ - Topics such as cross-origin, content security policy, mixed content, service workers are ignored, given our server-side context. | ||
- Only support `res.text()` and `res.json()` at the moment, until there are good use-cases for blob. | ||
- There is currently no built-in caching, as server-side caching varies by use-cases. |
{ | ||
"name": "node-fetch", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A light-weight module that brings window.fetch to node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -28,2 +28,5 @@ | ||
- Use native promise, but allow substituting it with [insert your favorite promise library]. | ||
- Use native stream for body, on both request and response. | ||
- Decode content encoding (gzip/deflate) properly, and convert string output (such as `res.text()` and `res.json()`) to utf-8 automatically. | ||
- Useful extensions such as timeout, redirect limit, response size limit. | ||
@@ -115,4 +118,2 @@ | ||
return res.json(); | ||
}).then(function(json) { | ||
console.log(json); | ||
}); | ||
@@ -127,2 +128,30 @@ | ||
# API | ||
## fetch(url, options) | ||
Returns a `Promise` | ||
### Url | ||
Should be an absolute url, eg `http://example.com/` | ||
### Options | ||
default values are shown, note that only `method`, `headers` and `body` are allowed in `window.fetch`, others are node.js extensions. | ||
``` | ||
{ | ||
method: 'GET' | ||
, headers: {} // request header, format {a:1} or {b:[1,2,3]} | ||
, follow: 20 // maximum redirect count, 0 to disable | ||
, timeout: 0 // request timeout in ms, 0 to disable, note that it's for each request when following redirect | ||
, compress: true // support gzip/deflate content encoding, false to disable | ||
, size: 0 // maximum response body size in bytes, 0 to disable | ||
, body: empty // request body, can be a string or readable stream | ||
, agent: null // custom http.Agent instance | ||
} | ||
``` | ||
# License | ||
@@ -129,0 +158,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
34902
170