fix: app user agent for api-client reqs using tauri http plugin (#6045)

fix: app user agent
This commit is contained in:
Calum H.
2026-05-08 20:52:52 +01:00
committed by GitHub
parent 7048a35e9f
commit a082e8597c
9 changed files with 80 additions and 66 deletions
+8 -4
View File
@@ -66,13 +66,17 @@ export interface NuxtClientConfig extends ClientConfig {
* ```typescript
* // In a Nuxt composable
* const config = useRuntimeConfig()
* const auth = await useAuth()
*
* const client = new NuxtModrinthClient({
* userAgent: 'my-nuxt-app/1.0.0',
* rateLimitKey: import.meta.server ? config.rateLimitKey : undefined,
* features: [
* new AuthFeature({ token: () => auth.value.token })
* new AuthFeature({
* token: async () => getOAuthToken()
* }),
* new CircuitBreakerFeature({
* storage: new NuxtCircuitBreakerStorage()
* })
* ]
* })
*
@@ -171,9 +175,9 @@ export class NuxtModrinthClient extends XHRUploadClient {
return super.normalizeError(error)
}
protected buildDefaultHeaders(): Record<string, string> {
protected async buildDefaultHeaders(): Promise<Record<string, string>> {
const headers: Record<string, string> = {
...super.buildDefaultHeaders(),
...(await super.buildDefaultHeaders()),
}
// Use the resolved key (populated by resolveRateLimitKey in request())