Skip to content

Conversation

@travis-hoover-glean
Copy link
Contributor

Summary

  • Add XGleanHeadersHook beforeRequest hook that sets X-Glean-Exclude-Deprecated-After and X-Glean-Experimental headers
  • Introduce new SDK options excludeDeprecatedAfter and includeExperimental with corresponding environment variable support
  • Add documentation for testing experimental features and deprecation testing

This is the Java SDK equivalent of gleanwork/api-client-typescript#95

Test plan

  • Verify headers are set correctly when using SDK constructor options
  • Verify headers are set correctly when using environment variables
  • Confirm environment variables take precedence over SDK options
  • Ensure no headers are set when neither option is configured
// Test with SDK options
Glean glean = Glean.builder()
        .apiToken(System.getenv("GLEAN_API_TOKEN"))
        .instance(System.getenv("GLEAN_INSTANCE"))
        .excludeDeprecatedAfter("2026-10-15")
        .includeExperimental(true)
        .build();

// Or using environment variables
// X_GLEAN_EXCLUDE_DEPRECATED_AFTER=2027-10-15
// X_GLEAN_INCLUDE_EXPERIMENTAL=true

…esting

Add XGlean beforeRequest hook that sets X-Glean-Exclude-Deprecated-After
and X-Glean-Experimental headers based on SDK options or environment
variables.

- Add `excludeDeprecatedAfter` and `includeExperimental` SDK builder options
- Add environment variable support: X_GLEAN_EXCLUDE_DEPRECATED_AFTER and
  X_GLEAN_INCLUDE_EXPERIMENTAL
- Environment variables take precedence over SDK options
- Add comprehensive test coverage for all scenarios
- Add documentation in README
@travis-hoover-glean travis-hoover-glean requested a review from a team as a code owner January 22, 2026 23:40
@travis-hoover-glean travis-hoover-glean merged commit 5ba9a83 into main Jan 22, 2026
@travis-hoover-glean travis-hoover-glean deleted the feat/x-glean-headers branch January 22, 2026 23:59
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.

3 participants