Skip to content

Commit

Permalink
Merge pull request #184 from manchenkoff/headers-logging
Browse files Browse the repository at this point in the history
feat: add request and response headers logging
  • Loading branch information
manchenkoff authored Sep 30, 2024
2 parents 78f7ebf + fed1d16 commit aff1d39
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/runtime/httpFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export function createHttpClient(nuxtApp: NuxtApp, logger: ConsolaInstance): $Fe
await interceptor(nuxtApp, context, logger)
})
}

logger.trace(
`Request headers for "${context.request.toString()}"`,
context.options.headers,
)
},

async onResponse(context: FetchContext): Promise<void> {
Expand All @@ -81,6 +86,11 @@ export function createHttpClient(nuxtApp: NuxtApp, logger: ConsolaInstance): $Fe
await interceptor(nuxtApp, context, logger)
})
}

logger.trace(
`Response headers for "${context.request.toString()}"`,
context.response?.headers,
)
},

async onResponseError({ response }): Promise<void> {
Expand Down

0 comments on commit aff1d39

Please sign in to comment.