Skip to content

feat: expose response headers from query composables#144

Merged
zedrdave merged 2 commits into
mainfrom
feat/response-headers
Mar 15, 2026
Merged

feat: expose response headers from query composables#144
zedrdave merged 2 commits into
mainfrom
feat/response-headers

Conversation

@zedrdave

Copy link
Copy Markdown
Member

Adds responseHeaders shallowRef to QueryReturn and LazyQueryReturn types, allowing consumers to access response headers (e.g., X-Pagination for pagination metadata) from the last successful query.

Changes

  • buildQueryFn accepts optional headersSink parameter to capture response headers
  • useEndpointQuery creates and returns a responseHeaders shallowRef
  • useEndpointLazyQuery exposes responseHeaders populated on fetch()
  • QueryReturn and LazyQueryReturn types updated with responseHeaders: ShallowRef<Record<string, string>>
  • New test file: tests/unit/response-headers.test.ts (8 tests)
  • Version bump: 0.21.0 → 0.21.1

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR exposes response headers from the most recent successful query execution via a new responseHeaders shallowRef on both query composables’ return types, enabling consumers to read metadata such as pagination headers.

Changes:

  • Captures axios response headers inside buildQueryFn and surfaces them on useEndpointQuery / useEndpointLazyQuery.
  • Extends QueryReturn / LazyQueryReturn types with responseHeaders.
  • Adds unit tests covering header exposure and updates package version + changelog entries.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/response-headers.test.ts Adds tests validating responseHeaders behavior for query and lazy query flows.
src/openapi-query.ts Implements header capture via headersSink and returns responseHeaders from composables/types.
src/index.ts Re-exports ShallowRef type for consumers.
package.json Bumps package version.
package-lock.json Updates lockfile version fields to match package version bump.
CHANGELOG.md Adds release notes for the new responseHeaders API.

Comment thread CHANGELOG.md Outdated
Comment thread src/openapi-query.ts Outdated
Comment thread tests/unit/response-headers.test.ts
Comment thread package.json
@zedrdave
zedrdave merged commit c6dbd3f into main Mar 15, 2026
3 checks passed
@zedrdave
zedrdave deleted the feat/response-headers branch March 15, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants