feat: log redirect (#17307)

This commit is contained in:
Tony 2024-10-25 08:48:32 -07:00 committed by GitHub
parent 3b73b60402
commit c97564446c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -26,6 +26,11 @@ const rofetch = createFetch().create({
headers: {
'user-agent': config.ua,
},
onResponse({ request, response }) {
if (response.redirected) {
logger.http(`Redirecting to ${response.url} for ${request}`);
}
},
});
export default rofetch;

View File

@ -23,7 +23,7 @@
"scripts": {
"build": "tsx scripts/workflow/build-routes.ts",
"build:docs": "tsx scripts/workflow/build-docs.ts",
"dev": "cross-env NODE_ENV=dev tsx watch --clear-screen=false lib/index.ts",
"dev": "cross-env NODE_ENV=dev tsx watch --inspect --clear-screen=false lib/index.ts",
"dev:cache": "cross-env NODE_ENV=production tsx watch --clear-screen=false lib/index.ts",
"format": "prettier \"**/*.{ts,tsx,js,json}\" --write && eslint --cache --fix \"**/*.{ts,tsx,js,yml}\"",
"format:check": "prettier \"**/*.{ts,tsx,js,json}\" --check && eslint --cache \"**/*.{ts,tsx,js,yml}\"",