This release is the result of a large bug hunt. Many of the fixes make Got match its documented behavior, so you may notice some of them:
- Invalid options now throw: an empty
method, a negative or fractionalmaxRedirectsorretry.limit, aprefixUrlwith a query string or fragment, and ahandlersentry that is not a function. - A stream with a
body,json, orformoption now rejects writes, as documented. - The promise
responseevent now only fires for the final response, not for every retry attempt. got.extend({body})(andjson,form) no longer sends the payload with every request of the instance. Payloads are never merged with defaults.instance.extend()now inherits the parent'smutableDefaults, likegot.extend(instance).- A
HEADrequest is no longer changed toGETon a301,302, or303redirect. response.bodyno longer keeps a leading UTF-8 byte order mark, and JSON with a byte order mark now parses.
Improvements
- Accept number values in
headers6fffc9e - Export the
Timings,DnsCacheLookup, andDnsCacheOptionstypes d012d1d eccaaca - Retry
FormDatabodies by re-serializing them instead of failing 90c6ec1 - Support the
x-gzipcontent coding and stacked content codings 5550a79
Fixes
- Fix many HTTP/2 edge cases, including requests that could hang forever when the response or request was destroyed d3c549c 78bf394 6bbc7f4 602b179 687b5c8 4ea02b8 b6522f3 9348ad6 c686386 3bbc37b 91dc486 11621cd
- Fix
timeout.requestrestarting on each redirect, and several timeout phase edge cases 9cd2ee6 df33cdb 4e4c583 795234f 0f1263d - Fix redirects: keep the URL fragment, evaluate
followRedirectonce per response, and keepContent-Lengthcorrect when a hook replaces the body 1febf3c a2b3d90 1d64f7c 60b48af - Fix
Infinitytimeouts firing at once or throwing 724ebc2 - Fix retry delay edge cases, including invalid
Retry-Aftervalues andcalculateDelayforafterResponseretries fe58b8c 0193605 - Fix retries with replaced or non-replayable bodies ae5521f 7c1cda3 8bbc79f 1a56d36 d012d1d
- Fix the default
paginateon real-worldLinkheaders, and several pagination option and limit edge cases bd2dee0 1e61807 602b179 f98d0e1 c8419e4 526a988 557e61f 4712e5b a4a50ad b65e533 - Fix
afterResponse,beforeRequest, andbeforeCachehook edge cases 45c201c c1cf0f8 850e49b a4a50ad 863cf30 494279b - Fix response body decoding and parsing edge cases c36ad51 c409a84 3c6eaf1 f658d3e dbd83df
- Fix stream edge cases: respect backpressure, stop forwarding after unpipe, and do not copy hop-by-hop headers to a piped
ServerResponse348e114 dc929bd dc56e4b c930cd9 a9a754f - Fix uploads:
DataViewbyte ranges, upload error classification, progresstotalforContent-Length: 0, and cancelling WebReadableStreambodies 2a66686 d1cb051 0238069 b57120c 200bc85 - Fix option normalization, cloning, and immutable defaults 8f44d81 687eb7d 30023f7 5548b00 bec5da6 bcc0b01 9348ad6 a9a754f 7b13369 3bd0486 d272656 0e537c7 60b62a0 129d88d
- Fix error stacks reporting
RequestErrorinstead of the real error class, and other error cause edge cases c8419e4 9d61a37 5ccac58 71f4e0e - Fix custom DNS cache lookups and DNS records without a valid TTL b3dc5c6 4ea02b8 d012d1d
- Fix cookie edge cases with retries, redirects, and async cookie jars 784bbd2 d5cd5e4
- Fix diagnostics channel coverage across retries and terminal errors cfce7b6
- Fix TypeScript types to match the runtime values 7c833b8 c59692b 88eeb13 0c17a8b c788ac9 a4176b6