user-agent.ts

defines global user-agent string for all http requests

instrumentation.ts
    sets axios default user-agent to our global user-agent string on library import
This commit is contained in:
Tom Bernens
2026-05-15 18:06:41 -07:00
parent 5f62ba7146
commit e65e737bee
2 changed files with 10 additions and 0 deletions
+7
View File
@@ -0,0 +1,7 @@
export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
const axios = (await import('axios')).default;
const { RMAB_USER_AGENT } = await import('@/lib/utils/user-agent');
axios.defaults.headers.common['User-Agent'] = RMAB_USER_AGENT;
}
}
+3
View File
@@ -0,0 +1,3 @@
import { version } from '../../../package.json';
export const RMAB_USER_AGENT = `rmab/${version}`;