CHANGELOG.md (10202B)
1 2 Changelog 3 ========= 4 5 6 # 2.x release 7 8 ## v2.6.1 9 10 **This is an important security release. It is strongly recommended to update as soon as possible.** 11 12 - Fix: honor the `size` option after following a redirect. 13 14 ## v2.6.0 15 16 - Enhance: `options.agent`, it now accepts a function that returns custom http(s).Agent instance based on current URL, see readme for more information. 17 - Fix: incorrect `Content-Length` was returned for stream body in 2.5.0 release; note that `node-fetch` doesn't calculate content length for stream body. 18 - Fix: `Response.url` should return empty string instead of `null` by default. 19 20 ## v2.5.0 21 22 - Enhance: `Response` object now includes `redirected` property. 23 - Enhance: `fetch()` now accepts third-party `Blob` implementation as body. 24 - Other: disable `package-lock.json` generation as we never commit them. 25 - Other: dev dependency update. 26 - Other: readme update. 27 28 ## v2.4.1 29 30 - Fix: `Blob` import rule for node < 10, as `Readable` isn't a named export. 31 32 ## v2.4.0 33 34 - Enhance: added `Brotli` compression support (using node's zlib). 35 - Enhance: updated `Blob` implementation per spec. 36 - Fix: set content type automatically for `URLSearchParams`. 37 - Fix: `Headers` now reject empty header names. 38 - Fix: test cases, as node 12+ no longer accepts invalid header response. 39 40 ## v2.3.0 41 42 - Enhance: added `AbortSignal` support, with README example. 43 - Enhance: handle invalid `Location` header during redirect by rejecting them explicitly with `FetchError`. 44 - Fix: update `browser.js` to support react-native environment, where `self` isn't available globally. 45 46 ## v2.2.1 47 48 - Fix: `compress` flag shouldn't overwrite existing `Accept-Encoding` header. 49 - Fix: multiple `import` rules, where `PassThrough` etc. doesn't have a named export when using node <10 and `--exerimental-modules` flag. 50 - Other: Better README. 51 52 ## v2.2.0 53 54 - Enhance: Support all `ArrayBuffer` view types 55 - Enhance: Support Web Workers 56 - Enhance: Support Node.js' `--experimental-modules` mode; deprecate `.es.js` file 57 - Fix: Add `__esModule` property to the exports object 58 - Other: Better example in README for writing response to a file 59 - Other: More tests for Agent 60 61 ## v2.1.2 62 63 - Fix: allow `Body` methods to work on `ArrayBuffer`-backed `Body` objects 64 - Fix: reject promise returned by `Body` methods when the accumulated `Buffer` exceeds the maximum size 65 - Fix: support custom `Host` headers with any casing 66 - Fix: support importing `fetch()` from TypeScript in `browser.js` 67 - Fix: handle the redirect response body properly 68 69 ## v2.1.1 70 71 Fix packaging errors in v2.1.0. 72 73 ## v2.1.0 74 75 - Enhance: allow using ArrayBuffer as the `body` of a `fetch()` or `Request` 76 - Fix: store HTTP headers of a `Headers` object internally with the given case, for compatibility with older servers that incorrectly treated header names in a case-sensitive manner 77 - Fix: silently ignore invalid HTTP headers 78 - Fix: handle HTTP redirect responses without a `Location` header just like non-redirect responses 79 - Fix: include bodies when following a redirection when appropriate 80 81 ## v2.0.0 82 83 This is a major release. Check [our upgrade guide](https://github.com/bitinn/node-fetch/blob/master/UPGRADE-GUIDE.md) for an overview on some key differences between v1 and v2. 84 85 ### General changes 86 87 - Major: Node.js 0.10.x and 0.12.x support is dropped 88 - Major: `require('node-fetch/lib/response')` etc. is now unsupported; use `require('node-fetch').Response` or ES6 module imports 89 - Enhance: start testing on Node.js v4.x, v6.x, v8.x LTS, as well as v9.x stable 90 - Enhance: use Rollup to produce a distributed bundle (less memory overhead and faster startup) 91 - Enhance: make `Object.prototype.toString()` on Headers, Requests, and Responses return correct class strings 92 - Other: rewrite in ES2015 using Babel 93 - Other: use Codecov for code coverage tracking 94 - Other: update package.json script for npm 5 95 - Other: `encoding` module is now optional (alpha.7) 96 - Other: expose browser.js through package.json, avoid bundling mishaps (alpha.9) 97 - Other: allow TypeScript to `import` node-fetch by exposing default (alpha.9) 98 99 ### HTTP requests 100 101 - Major: overwrite user's `Content-Length` if we can be sure our information is correct (per spec) 102 - Fix: errors in a response are caught before the body is accessed 103 - Fix: support WHATWG URL objects, created by `whatwg-url` package or `require('url').URL` in Node.js 7+ 104 105 ### Response and Request classes 106 107 - Major: `response.text()` no longer attempts to detect encoding, instead always opting for UTF-8 (per spec); use `response.textConverted()` for the v1 behavior 108 - Major: make `response.json()` throw error instead of returning an empty object on 204 no-content respose (per spec; reverts behavior changed in v1.6.2) 109 - Major: internal methods are no longer exposed 110 - Major: throw error when a `GET` or `HEAD` Request is constructed with a non-null body (per spec) 111 - Enhance: add `response.arrayBuffer()` (also applies to Requests) 112 - Enhance: add experimental `response.blob()` (also applies to Requests) 113 - Enhance: `URLSearchParams` is now accepted as a body 114 - Enhance: wrap `response.json()` json parsing error as `FetchError` 115 - Fix: fix Request and Response with `null` body 116 117 ### Headers class 118 119 - Major: remove `headers.getAll()`; make `get()` return all headers delimited by commas (per spec) 120 - Enhance: make Headers iterable 121 - Enhance: make Headers constructor accept an array of tuples 122 - Enhance: make sure header names and values are valid in HTTP 123 - Fix: coerce Headers prototype function parameters to strings, where applicable 124 125 ### Documentation 126 127 - Enhance: more comprehensive API docs 128 - Enhance: add a list of default headers in README 129 130 131 # 1.x release 132 133 ## backport releases (v1.7.0 and beyond) 134 135 See [changelog on 1.x branch](https://github.com/bitinn/node-fetch/blob/1.x/CHANGELOG.md) for details. 136 137 ## v1.6.3 138 139 - Enhance: error handling document to explain `FetchError` design 140 - Fix: support `form-data` 2.x releases (requires `form-data` >= 2.1.0) 141 142 ## v1.6.2 143 144 - Enhance: minor document update 145 - Fix: response.json() returns empty object on 204 no-content response instead of throwing a syntax error 146 147 ## v1.6.1 148 149 - Fix: if `res.body` is a non-stream non-formdata object, we will call `body.toString` and send it as a string 150 - Fix: `counter` value is incorrectly set to `follow` value when wrapping Request instance 151 - Fix: documentation update 152 153 ## v1.6.0 154 155 - Enhance: added `res.buffer()` api for convenience, it returns body as a Node.js buffer 156 - Enhance: better old server support by handling raw deflate response 157 - Enhance: skip encoding detection for non-HTML/XML response 158 - Enhance: minor document update 159 - Fix: HEAD request doesn't need decompression, as body is empty 160 - Fix: `req.body` now accepts a Node.js buffer 161 162 ## v1.5.3 163 164 - Fix: handle 204 and 304 responses when body is empty but content-encoding is gzip/deflate 165 - Fix: allow resolving response and cloned response in any order 166 - Fix: avoid setting `content-length` when `form-data` body use streams 167 - Fix: send DELETE request with content-length when body is present 168 - Fix: allow any url when calling new Request, but still reject non-http(s) url in fetch 169 170 ## v1.5.2 171 172 - Fix: allow node.js core to handle keep-alive connection pool when passing a custom agent 173 174 ## v1.5.1 175 176 - Fix: redirect mode `manual` should work even when there is no redirection or broken redirection 177 178 ## v1.5.0 179 180 - Enhance: rejected promise now use custom `Error` (thx to @pekeler) 181 - Enhance: `FetchError` contains `err.type` and `err.code`, allows for better error handling (thx to @pekeler) 182 - Enhance: basic support for redirect mode `manual` and `error`, allows for location header extraction (thx to @jimmywarting for the initial PR) 183 184 ## v1.4.1 185 186 - Fix: wrapping Request instance with FormData body again should preserve the body as-is 187 188 ## v1.4.0 189 190 - Enhance: Request and Response now have `clone` method (thx to @kirill-konshin for the initial PR) 191 - Enhance: Request and Response now have proper string and buffer body support (thx to @kirill-konshin) 192 - Enhance: Body constructor has been refactored out (thx to @kirill-konshin) 193 - Enhance: Headers now has `forEach` method (thx to @tricoder42) 194 - Enhance: back to 100% code coverage 195 - Fix: better form-data support (thx to @item4) 196 - Fix: better character encoding detection under chunked encoding (thx to @dsuket for the initial PR) 197 198 ## v1.3.3 199 200 - Fix: make sure `Content-Length` header is set when body is string for POST/PUT/PATCH requests 201 - Fix: handle body stream error, for cases such as incorrect `Content-Encoding` header 202 - Fix: when following certain redirects, use `GET` on subsequent request per Fetch Spec 203 - Fix: `Request` and `Response` constructors now parse headers input using `Headers` 204 205 ## v1.3.2 206 207 - Enhance: allow auto detect of form-data input (no `FormData` spec on node.js, this is form-data specific feature) 208 209 ## v1.3.1 210 211 - Enhance: allow custom host header to be set (server-side only feature, as it's a forbidden header on client-side) 212 213 ## v1.3.0 214 215 - Enhance: now `fetch.Request` is exposed as well 216 217 ## v1.2.1 218 219 - Enhance: `Headers` now normalized `Number` value to `String`, prevent common mistakes 220 221 ## v1.2.0 222 223 - Enhance: now fetch.Headers and fetch.Response are exposed, making testing easier 224 225 ## v1.1.2 226 227 - Fix: `Headers` should only support `String` and `Array` properties, and ignore others 228 229 ## v1.1.1 230 231 - Enhance: now req.headers accept both plain object and `Headers` instance 232 233 ## v1.1.0 234 235 - Enhance: timeout now also applies to response body (in case of slow response) 236 - Fix: timeout is now cleared properly when fetch is done/has failed 237 238 ## v1.0.6 239 240 - Fix: less greedy content-type charset matching 241 242 ## v1.0.5 243 244 - Fix: when `follow = 0`, fetch should not follow redirect 245 - Enhance: update tests for better coverage 246 - Enhance: code formatting 247 - Enhance: clean up doc 248 249 ## v1.0.4 250 251 - Enhance: test iojs support 252 - Enhance: timeout attached to socket event only fire once per redirect 253 254 ## v1.0.3 255 256 - Fix: response size limit should reject large chunk 257 - Enhance: added character encoding detection for xml, such as rss/atom feed (encoding in DTD) 258 259 ## v1.0.2 260 261 - Fix: added res.ok per spec change 262 263 ## v1.0.0 264 265 - Enhance: better test coverage and doc 266 267 268 # 0.x release 269 270 ## v0.1 271 272 - Major: initial public release