@eraop/fetch-hook
Fetch Hook
Intercept, transform, and debug every fetch request with a simple hook — zero dependencies.
GitHub
Hook Configuration
hookFetch
({
urlHook
:
function
(
url
) {
// Rewrite /get → /post
url
=
url
.
replace
(
"/get"
,
"/post"
)
return
url
},
optionsHook
:
function
(
opts
) {
// Force POST + inject custom header
opts
.
method
=
"POST"
opts
.
headers
=
{ ...
opts
.
headers
,
"X-Client"
:
"fetch-hook-demo"
}
return
opts
} })
Playground
▸ Send Request
Unhook
Hook active
Console Output
logs
Clear
Press "Send Request" to see intercepted output…