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