diff --git a/CHANGELOG.md b/CHANGELOG.md index 13b700d..d695f51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,12 @@ Changelog # 1.x release -## v1.4.1 (master) +## v1.5.0 (master) + +- Enhance: rejected promise now use custom `Error` (thx to @pekeler) +- Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) + +## v1.4.1 - Fix: wrapping Request instance with FormData body again should preserve the body as-is diff --git a/LICENSE.md b/LICENSE.md index 7c0c89b..660ffec 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 David Frank +Copyright (c) 2016 David Frank Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/LIMITS.md b/LIMITS.md index 8278f18..18b1bfb 100644 --- a/LIMITS.md +++ b/LIMITS.md @@ -14,6 +14,8 @@ Known differences - Similarly, `req.body` can either be a string or a readable stream. +- Also, you can handle rejected fetch requests through checking `err.type` and `err.code`. + - 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. diff --git a/README.md b/README.md index 634c298..74353c9 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ node-fetch [![build status][travis-image]][travis-url] [![coverage status][coveralls-image]][coveralls-url] -A light-weight module that brings `window.fetch` to node.js & io.js +A light-weight module that brings `window.fetch` to Node.js # Motivation @@ -15,7 +15,7 @@ I really like the notion of Matt Andrews' [isomorphic-fetch](https://github.com/ Instead of implementing `XMLHttpRequest` in node to run browser-specific [fetch polyfill](https://github.com/github/fetch), why not go from node's `http` to `fetch` API directly? Node has native stream support, browserify build targets (browsers) don't, so underneath they are going to be vastly different anyway. -Hence `node-fetch`, minimal code for a `window.fetch` compatible API on node.js/io.js runtime. +Hence `node-fetch`, minimal code for a `window.fetch` compatible API on Node.js runtime. # Features @@ -25,7 +25,7 @@ Hence `node-fetch`, minimal code for a `window.fetch` compatible API on node.js/ - 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. +- Useful extensions such as timeout, redirect limit, response size limit, explicit reject errors. # Difference from client-side fetch @@ -157,7 +157,7 @@ default values are shown, note that only `method`, `headers` and `body` are allo , 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 + , agent: null // http.Agent instance, allows custom proxy, certificate etc. } ```