chore(deps): update dependency ky to v2#255
Open
renovate[bot] wants to merge 1 commit intomasterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
^0.25.1→^2.0.2Release Notes
sindresorhus/ky (ky)
v2.0.2Compare Source
add0703searchParamsmutations leaking across init-hook requests (#861)346f898v2.0.1Compare Source
fetchimplementations (#858)29719912df9b7ev2.0.0Compare Source
Breaking
f1da0fcecdd45e{request, options, retryCount, ...}state object instead of separate arguments.prefixUrltoprefix, and allow leading slashes in input (#606)1f2ad7fbeforeErrorhook receive all errors, not justHTTPError(#829)101c74b.json()throw on empty bodies and204responses instead of returning an empty string (#854)1b8e1ffsearchParamswith input URL instead of replacing (#840)29e78fe433febd90c6d00New
totalTimeoutoption for an overall timeout across all retries (#848)c20d7c7baseUrloption for standard URL resolution (#606)1f2ad7fbaseUrluses standard URL resolution:/usersmeans origin-root,usersmeans relative to the base path.prefixdoes simple string joining first, so/usersandusersboth append to the prefix the same way. Use it only when you want that behavior.dataproperty toHTTPErrorwith pre-parsed response body (#823)1341f5cinithook (#841)87c6740NetworkErrorclass and tighten retry logic (#842)eaf0b80.json()(#830)94741a9replaceOptionhelper for.extend()(#846)bb8412erequestandoptionstobeforeErrorhook state (#835)01e0b85parseJsonoption (#849)3713ce8HTTPErrorfor opaque responses fromno-corsrequests (#847)1d15eb6onUploadProgresswhen request streams are unsupported (#845)1e38ff4Fixes
beforeRequesthooks being skipped when aRequestis returned (#832)aec65dbbeforeErrorhooks (#833)a541fc0Migration guide
Hook signatures
All hooks now receive a single state object instead of separate arguments.
hooks: { - beforeRequest: [(request, options) => { + beforeRequest: [({request, options}) => { request.headers.set('X-Custom', 'value'); }], - afterResponse: [(request, options, response) => { + afterResponse: [({request, options, response}) => { log(response.status); }], - beforeRetry: [({request, options, error, retryCount}) => { + beforeRetry: [({request, options, error, retryCount}) => { // Same as before - beforeRetry already used an object }], - beforeError: [(error) => { + beforeError: [({error}) => { return error; }], }prefixUrlrenamed toprefixLeading slashes in input are now allowed with
prefix. There's also a newbaseUrloption for standard URL resolution, which you may prefer overprefix.beforeErrorhook receives all errorsPreviously only received
HTTPError. Now receives all error types. Use type guards:.json()on empty responses.json()now throws a parse error on empty bodies and204responses instead of returning an empty string. This aligns with nativeJSON.parsebehavior and surfaces the real issue; your code expected JSON but the server sent none.Check the status before calling
.json()if you expect empty responses:Ky-specific options stripped from hooks
Ky-specific properties (
hooks,json,parseJson,stringifyJson,searchParams,timeout,throwHttpErrors,fetch) are no longer available on theoptionsobject passed to hooks. If you need access to these values, store them in a variable outside the hook or use thecontextoption to pass data between hooks.searchParamsmergingsearchParamsnow merges with existing query parameters in the input URL instead of replacing them.HTTPErrorresponse bodyerror.response.json()and other body methods no longer work since the body is now automatically consumed. Useerror.datainstead, which has the pre-parsed response body immediately available.This fixes resource leaks when catching
HTTPErrorwithout consuming the body (#633) and makes error details synchronously available (#642). We considered cloning the response to keep both paths working, but that doubles memory usage for error bodies and adds edge cases around locked/large streams for little benefit.error.responseis still available for headers and status.Upgrading from
2.0.0-0.json()on empty responsesThe behavior changed again from the prerelease.
.json()now throws instead of returningundefinedfor empty bodies and204responses. The return type is back toPromise<T>(no more| undefined).Thanks to @sholladay for helping with this update.
v1.14.3Compare Source
contextobject being added to mergedjsonbodyd7f7e73v1.14.2Compare Source
2bdbd59e673eaaisKyErrortype guard includeForceRetryError(#801)5791b66retry.methodsand improve typing (#789)cec10a9v1.14.1Compare Source
backoffLimitbeingundefined(#796)4fd8c28v1.14.0Compare Source
ky.retry()to force retries fromafterResponsehooks (#779)68a5228throwHttpErrorsoption to be a function (#781)84ff3b9v1.13.0Compare Source
Improvements
contextoption (#772)1e749baretry.shouldRetryoption (#767)f0fdbd4retry.retryOnTimeoutoption (#767)f0fdbd4retry.jitteroption (#760)081c924beforeRetryhooks to return aRequestorResponse(#774)a51bb1eFixes
nextoption support (#775)caf78d2c488be0v1.12.0Compare Source
Improvements
afterResponseandbeforeErrorhooks (#763)37fc250beforeRequesthook (#754)b7572d07e1fd0bFixes
dispatcheroption being ignored (#757)5a3fc90hooksfield incorrectly included inNormalizedOptions(#726) (#756)0f2f00asearchParamsoption merging withURLSearchParamsinstances (#755)c847eecsignalmerging when using both instance and request options (#751)2b0a100content-typeboundary regeneration when retrying in hooks (#752)d02b636v1.11.0Compare Source
onDownloadProgressandonUploadProgress(#736)60958f99a89a35v1.10.0Compare Source
undefinedvalues forsearchParamsobject (#729)a87d9e9.json()(#731)8cd79d3v1.9.1Compare Source
uploadProgresswith form data (#725)3a8f89cv1.9.0Compare Source
.bytes()shortcut (#720)d11228317ca389v1.8.2Compare Source
AbortSignal.any()not being available (#711)24eec6fv1.8.1Compare Source
1f903edv1.8.0Compare Source
onUploadProgressoption (#632)a53fd34e48386eb49cd03v1.7.5Compare Source
options.methodbeingundefinedin normalized options (#671)762ea4cv1.7.4Compare Source
6d06338v1.7.3Compare Source
30e7afdv1.7.2Compare Source
ky.create()options as optional (#628)8d2ca91v1.7.1Compare Source
32a720dv1.7.0Compare Source
ky()andHTTPError(#619)f76c7cdv1.6.0Compare Source
RateLimit-Resetheader (#618)8531b05.extend()(#599)00170532376cf2v1.5.0Compare Source
retry.afterStatusCodesoption (#598)8764419ky.extend()(#611)9587c9dKyRequestandKyResponsetypes (#610)8e171f54886b66v1.4.0Compare Source
36d0bd3Retry-Aftertime toretry.maxRetryAfter(#603)f0f9111c5be841974f1e9b1effd9v1.3.0Compare Source
stringifyJsonoption (#579)2eea67ev1.2.4Compare Source
10a4ec7v1.2.3Compare Source
exactOptionalPropertyTypesconfig and compatibility with TypeScript 5.4 (#565)08f912dv1.2.2Compare Source
c0a4dfav1.2.1Compare Source
d8ee602v1.2.0Compare Source
Improvements
3cf5064InputTypeScript type (#552)4dd4077FIxes
retryCountoption retrying an incorrect amount (#547)917ab12v1.1.3Compare Source
KyInstancetype16eb51dv1.1.2Compare Source
0e9d7bbv1.1.1Compare Source
fetchoptions (#536)e93bc6dv1.1.0Compare Source
retry.delayoption to control the time between retries (#533)c6181efv1.0.1Compare Source
OptionsandNormalizedOptionsTypeScript types back to beinterface4d63a21v1.0.0Compare Source
Breaking
a8a3a26Improvements
fetch.ky-universalis no longer needed.v0.33.3Compare Source
00e45d0v0.33.2Compare Source
ce8588dv0.33.1Compare Source
ae2fe07v0.33.0Compare Source
retry.backoffLimitoption (#454)ab19bafv0.32.2Compare Source
.json()(#466)bf9eca6v0.32.1Compare Source
.json()ifTransfer-Encodingischunked(#464)195e0e2v0.32.0Compare Source
.json()(#459)1cc6bbbdddf7bav0.31.4Compare Source
onDownloadProgressoptionbccbfdbv0.31.3Compare Source
0b141f1v0.31.2Compare Source
316fffev0.31.1Compare Source
onDownloadProgress(#444)d48ed95v0.31.0Compare Source
Breaking
e557973Improvements
cff4c7aBeforeRetryStatetype (#442)e4077b9Fixes
onDownloadProgress(#441)f34fb1fv0.30.0Compare Source
Content-Typeheader for JSON requests (#429)d00864fv0.29.0Compare Source
beforeErrorhook (#417)616d276v0.28.7Compare Source
b0e3001v0.28.6Compare Source
ca20d65v0.28.5Compare Source
ad991fav0.28.4Compare Source
8fc2f22v0.28.3Compare Source
5f3c315v0.28.2Compare Source
OptionsTypeScript type3ad1eabmainfield in package.json (#342)1338996v0.28.1Compare Source
searchParamsoption TypeScript type (#344)010b082v0.28.0Compare Source
Breaking
HTTPErrorandTimeoutErrornamed exports6ec7fd7Improvements
HTTPErrormessages (#333)ca098f8Fixes
searchParamsin.create()and.extend()(#335)b3c9e88throwHttpErrorsoption is false (#334)eefcde5Meta
2d8d68av0.27.0Compare Source
searchParamsstring (#325)5815518v0.26.0Compare Source
Breaking
d9760291a7ec7f1a7ec7fImprovements
requestandoptionstoHTTPError(#309)519d17eFixes
onDownloadProgressthrows an exception (#301)87c94fdky.stopas return type inBeforeRetryHookTypeScript type (#307)b86ff0aBeforeRetryHookandNormalizedOptionsTypeScript type definitions (#308)5da3da0Docs
ky.stop(#314)0ced1f1Configuration
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.