Skip to content

feat: add HTTP header support for method arguments#53

Closed
klaidliadon wants to merge 4 commits intomasterfrom
header
Closed

feat: add HTTP header support for method arguments#53
klaidliadon wants to merge 4 commits intomasterfrom
header

Conversation

@klaidliadon
Copy link
Copy Markdown
Contributor

Summary

  • Add support for routing method arguments to HTTP headers using MethodArgument.Location from the webrpc schema
  • Client sends header-located arguments as HTTP headers and excludes them from the JSON body
  • Server extracts header arguments from request headers with type-specific parsing (string, number, boolean)

Changes

  • client.go.tmpl: Header inputs set as HTTP headers via _headers Record; body-only inputs sent via destructuring; works for both streaming and non-streaming paths
  • server.go.tmpl: Add reqHeaders parameter to serve*Rpc and dispatch*Request; build args object combining header + body values with case-insensitive header lookup and type coercion
  • _examples/node-ts-header/: New example with RIDL schema, Node HTTP server, and 6 vitest tests
  • _examples/node-ts, sse: Regenerated with updated templates

Test plan

  • node-ts-header example: 6/6 tests pass (ping, header auth, missing token, multiple headers, all-headers, unauthorized)
  • Regenerated examples produce expected output

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.

1 participant