Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[3.x] Add onHttpException, onNetworkError, and response to onSuccess in useHttp#3050

Merged
pascalbaljet merged 1 commit into
3.xfrom
3.x-usehttp-events
Apr 7, 2026
Merged

[3.x] Add onHttpException, onNetworkError, and response to onSuccess in useHttp#3050
pascalbaljet merged 1 commit into
3.xfrom
3.x-usehttp-events

Conversation

@pascalbaljet
Copy link
Copy Markdown
Member

The useHttp hook was missing the onHttpException and onNetworkError callbacks that are available on regular Inertia visits. Non-422 error responses were thrown as HttpResponseError with no callback, forcing users to manually catch and parse errors via try/catch. Network failures were similarly unhandled.

It also passes the raw HttpResponse as a second argument to onSuccess, so users can inspect the status code to differentiate between 200 and 204 responses.

Fixes #3039.

@pascalbaljet pascalbaljet merged commit a7a499e into 3.x Apr 7, 2026
55 checks passed
@pascalbaljet pascalbaljet deleted the 3.x-usehttp-events branch April 7, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't access errors returned from the server when using useHttp

1 participant