Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(interpolation): return empty string for unresolved variables#107

Open
diegoQuinas wants to merge 1 commit into
berbicanes:main from
diegoQuinas:fix/unresolved-vars-empty-string
Open

fix(interpolation): return empty string for unresolved variables #107
diegoQuinas wants to merge 1 commit into
berbicanes:main from
diegoQuinas:fix/unresolved-vars-empty-string

Conversation

@diegoQuinas

@diegoQuinas diegoQuinas commented Jun 9, 2026

Copy link
Copy Markdown

Description

When a variable referenced in request headers is not defined in the current environment, interpolate() now returns an empty string instead of leaving the raw {{var}} template literal. Headers with empty values are then filtered out before the request is sent.

This prevents server-side rejection when switching between environments that have different variable sets defined.

Changes

File Change
apps/desktop/src-tauri/src/http/interpolation.rs Return "" for unresolved vars (was {{var}} literal). Updated test test_unresolved_left_as_istest_unresolved_returns_empty. Added test_mixed_known_and_unknown.
apps/cli/src/interpolation.rs Same one-line change for CLI parity.
apps/desktop/src-tauri/src/http/request_builder.rs Filter out headers with empty values post-interpolation in both build_request and AWSv4 auth flows.
apps/desktop/src-tauri/src/http/error_classifier.rs Walk reqwest error source chain so builder errors include the actual cause (e.g. "invalid header value") rather than just "builder error".
apps/desktop/src-tauri/tests/integration_tests.rs Updated assertions for new behavior. Added test_empty_header_filtered integration test.

Test Plan

  • cargo test — 65 unit + 69 integration tests pass, 0 failures
  • CLI crate compiles successfully
  • test_unresolved_preserved now asserts "" instead of {{unknown}}
  • test_mixed_vars updated to expect empty string for unresolved portion
  • test_empty_header_filtered verifies empty-value headers are excluded but non-empty headers remain

Breaking Changes

None. The behavior change is backward compatible — variables that exist still resolve normally. The only difference is that unresolved {{var}} references no longer produce invalid header values.

Closes #106

 When a variable referenced in request headers (e.g. {{X_STG_TOKEN}})
 is not defined in the current environment, interpolate() now returns
 an empty string instead of leaving the raw {{var}} template literal.
 Headers with empty values are then filtered out before the request is
 sent, preventing server-side rejection due to unresolved variables.
 Also improves error_classifier to walk the source chain of reqwest
 builder errors, so the actual cause (e.g. "invalid header value") is
 visible in error messages.
@diegoQuinas diegoQuinas force-pushed the fix/unresolved-vars-empty-string branch from f2c89d1 to 8fbc517 Compare June 9, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Unresolved {{variables}} in headers cause request failure when switching environments

1 participant

AltStyle によって変換されたページ (->オリジナル) /