Skip to content

feat: add withLargeResponse runner wrapper - #9

Merged
josecarneiro merged 2 commits into
mainfrom
feat/large-response-runner-wrapper
Aug 5, 2026
Merged

feat: add withLargeResponse runner wrapper#9
josecarneiro merged 2 commits into
mainfrom
feat/large-response-runner-wrapper

Conversation

@josecarneiro

Copy link
Copy Markdown
Contributor

Interceptors only run for requests that go through the axios adapter. Clients that register their own runner — how service-to-service lambda invokes are wired — bypass it, so responses over the payload limit fail with a 413. Hit in template-variables-api, where it surfaced as a generic 500.

withLargeResponse(runner, options) wraps any runner with the same behaviour and options. It's typed structurally, so it isn't tied to Lambda or any transport and adds no dependency. The wrapped runner is spread rather than rebuilt — openapi-client-axios calls runner.runRequest(req, operation, runner.context) and the lambda runner reads its target function name off that context, so dropping it breaks every request. There's a test pinning that.

Two extras: the interceptor now shares the ref-detection helper, which makes its content-type check tolerate ; charset=utf-8 and header casing (more permissive, pre-existing tests unmodified — shout if you'd rather split it out). README documents the new export and fixes the refProperty default, documented as $payloadRef where the code and middleware both use $payload_ref.

33 tests (13 new), lint/typecheck/build clean. Verified on dev through template-variables-api: 413 → 200 on an order with 100 hydrated reverse relations, e2e green.

@jpinho jpinho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! 🙌

…ce README

- Bump package version to 0.0.3-alpha.1.
- Clarify comments in README regarding per-request options and runner structure.
- Update TypeScript configuration to exclude test files.
- Refactor types for better clarity and maintainability.
- Improve tests for axios integration and runner behavior.
- Ensure proper handling of undefined options in utility functions.
@josecarneiro
josecarneiro merged commit cdff17c into main Aug 5, 2026
1 check passed
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