rpcserver: add GetRequest, remove convenience wrappers#64
Merged
Conversation
07e111d to
c38df3d
Compare
- Add GetRequest(ctx) to access the full HTTP request from handlers - Export FlashbotsOriginHeader constant for callers to use - Remove GetHeader, GetOrigin, WithOrigin convenience wrappers - Remove ExtractOriginFromHeader option (moved to app layer) This follows idiomatic Go patterns - provide raw request access, let callers use standard req.Header.Get() for header access. Co-Authored-By: Claude <noreply@anthropic.com>
c38df3d to
e997be0
Compare
odysseus0
added a commit
that referenced
this pull request
Jan 22, 2026
Allows downstream repos to use the constant instead of string literals. Follow-up to #64. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2 tasks
odysseus0
added a commit
that referenced
this pull request
Jan 30, 2026
## Summary - Restores `GetOrigin`, `WithOrigin`, and `ExtractOriginFromHeader` removed in #64 - Allows existing code to continue using `GetOrigin(ctx)` pattern ## Why PR #64 removed these in favor of `GetRequest(ctx)`, but downstream repos still use the old pattern. This unblocks those repos without requiring migration. ## Test plan - [x] `go build ./...` - [x] `go test ./rpcserver/...` 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR does two things:
1. Refactor: Idiomatic header access pattern
GetRequest(ctx)to access the full HTTP request from handlersFlashbotsOriginHeaderconstantGetHeader,GetOrigin,WithOrigin)ExtractOriginFromHeaderoptionWhy? The old pattern required modifying go-utils every time we wanted to extract a new header. Want User-Agent? Add
GetUserAgent(). Want another header? Add another function. This is inconvenient and creates unnecessary coupling.The new pattern exposes the request directly - callers use standard
req.Header.Get()to access any header without touching go-utils.2. Feature: User-Agent header support
FlashbotsUserAgentHeaderconstant (X-Flashbots-User-Agent)Why combined? The refactor enables the feature - with
GetRequest(ctx), we can add User-Agent support without adding yet another wrapper function.Related PRs
These PRs depend on this one and should be reviewed together:
Migration
Breaking changes
GetOrigin(),GetHeader(),WithOrigin()removedExtractOriginFromHeaderoption removedImpact: Searched all flashbots repos on GitHub - only protect-rpc, protect-of-api, and mev-share-node-pareto actively use these (all have PRs ready). mev-share-node also references them but is inactive (last push: Jan 2025).
Test plan