Skip to content

Make x-notte-request-origin header configurable via env var#23

Merged
giordano-lucas merged 2 commits intomainfrom
feature/feat/configurable-request-origin
Apr 11, 2026
Merged

Make x-notte-request-origin header configurable via env var#23
giordano-lucas merged 2 commits intomainfrom
feature/feat/configurable-request-origin

Conversation

@giordano-lucas
Copy link
Copy Markdown
Member

@giordano-lucas giordano-lucas commented Apr 11, 2026

  • Add NOTTE_REQUEST_ORIGIN env var to override the default "cli" origin
  • Add WithRequestOrigin client option and thread it through resilientTransport
  • Add test for custom request origin header

Greptile Summary

This PR makes the x-notte-request-origin header configurable via the NOTTE_REQUEST_ORIGIN environment variable, adding a WithRequestOrigin client option and threading it through resilientTransport. The change is clean, well-tested, and follows the existing options pattern.

Confidence Score: 5/5

Safe to merge — the only finding is an unused exported constant, which is a minor cleanup concern.

All changes are correct, the options pattern is properly followed, empty-env-var edge case is handled, and a targeted test is included. The single P2 finding (unused DefaultRequestOrigin constant) does not affect runtime behavior.

internal/config/config.go — DefaultRequestOrigin constant is exported but unreferenced.

Important Files Changed

Filename Overview
internal/api/client.go Adds requestOrigin field, WithRequestOrigin option, and threads it through resilientTransport. Implementation is correct and consistent with the existing options pattern.
internal/config/config.go Adds DefaultRequestOrigin and EnvRequestOrigin constants, but DefaultRequestOrigin is never referenced — client.go hardcodes "cli" independently.
internal/cmd/root.go Reads NOTTE_REQUEST_ORIGIN env var and conditionally applies WithRequestOrigin; correctly skips the option when the env var is unset or empty.
internal/api/client_test.go Adds TestResilientTransport_CustomRequestOrigin that verifies the custom origin header is sent; test is clear and well-structured.
.env.example Documents the new NOTTE_REQUEST_ORIGIN env var; value shown (cli) matches the hardcoded default.

Fix All in Claude Code

Prompt To Fix All With AI
This is a comment left during a code review.
Path: internal/config/config.go
Line: 20

Comment:
**`DefaultRequestOrigin` constant is unused**

`DefaultRequestOrigin` is declared here but never referenced anywhere in the codebase — `client.go` hardcodes `"cli"` directly (line 64). Either use this constant in `NewClientWithURL` (or wherever the default is set) or remove it to avoid misleading future readers into thinking it governs the default.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (3): Last reviewed commit: "update sdk" | Re-trigger Greptile

- Add NOTTE_REQUEST_ORIGIN env var to override the default "cli" origin
- Add WithRequestOrigin client option and thread it through resilientTransport
- Add test for custom request origin header
@giordano-lucas
Copy link
Copy Markdown
Member Author

@greptile review

@giordano-lucas giordano-lucas merged commit 43a6a52 into main Apr 11, 2026
2 of 3 checks 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.

1 participant