Skip to content

Commit

Permalink
feat: log redirect (#17307)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Oct 25, 2024
1 parent 3b73b60 commit c975644
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/utils/ofetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}\"",
Expand Down

0 comments on commit c975644

Please sign in to comment.