Skip to content

feat(http): unify extractor and predicate APIs for 0.3#202

Open
singulared wants to merge 1 commit intomainfrom
predicate-api
Open

feat(http): unify extractor and predicate APIs for 0.3#202
singulared wants to merge 1 commit intomainfrom
predicate-api

Conversation

@singulared
Copy link
Member

@singulared singulared commented Feb 3, 2026

Introduce Config-based API for extractors and Into shorthands for predicates, making the API more ergonomic and consistent. closes #88

Extractors:

  • Add extractor() entry point function
  • Add Config types: MethodConfig, PathConfig, VersionConfig, HeaderConfig, QueryConfig, BodyConfig
  • Rename PathConfig::new() to PathConfig::pattern()
  • Re-export extension traits from extractors module

Predicates:

  • Add Into implementations for direct value usage
  • Allow .method(Method::GET) instead of .method(method::Operation::eq(...))
  • Allow .status(StatusCode::OK) instead of .status(status::Operation::eq(...))

Breaking changes documented in hitbox-http/MIGRATION.md

Introduce Config-based API for extractors and Into<Operation> shorthands
for predicates, making the API more ergonomic and consistent.

Extractors:
- Add `extractor()` entry point function
- Add Config types: MethodConfig, PathConfig, VersionConfig,
  HeaderConfig, QueryConfig, BodyConfig
- Rename PathConfig::new() to PathConfig::pattern()
- Re-export extension traits from extractors module

Predicates:
- Add Into<Operation> implementations for direct value usage
- Allow `.method(Method::GET)` instead of `.method(method::Operation::eq(...))`
- Allow `.status(StatusCode::OK)` instead of `.status(status::Operation::eq(...))`

Breaking changes documented in hitbox-http/MIGRATION.md
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 46.38158% with 163 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.78%. Comparing base (93121a6) to head (ca2faa9).
⚠️ Report is 12 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
hitbox-http/src/extractors/body.rs 8.62% 53 Missing ⚠️
hitbox-http/src/predicates/header/operation.rs 0.00% 23 Missing ⚠️
hitbox-http/src/extractors/header.rs 56.25% 14 Missing ⚠️
hitbox-http/src/extractors/query.rs 56.25% 14 Missing ⚠️
hitbox-configuration/src/config.rs 0.00% 10 Missing ⚠️
hitbox-http/src/predicates/body/operation.rs 0.00% 10 Missing ⚠️
hitbox-http/src/predicates/response/status.rs 60.86% 9 Missing ⚠️
hitbox-http/src/predicates/request/path.rs 57.14% 6 Missing ⚠️
hitbox-http/src/predicates/request/query.rs 64.70% 6 Missing ⚠️
hitbox-http/src/extractors/mod.rs 0.00% 3 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #202      +/-   ##
==========================================
- Coverage   80.18%   78.78%   -1.41%     
==========================================
  Files         111      113       +2     
  Lines        7394     7594     +200     
==========================================
+ Hits         5929     5983      +54     
- Misses       1465     1611     +146     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@singulared singulared added this to the 0.3.0 milestone Feb 6, 2026
@singulared singulared added configuration-api configuration api related issues predicates Predicates related issues labels Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

configuration-api configuration api related issues predicates Predicates related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Core builder API for predicates, extractors, and policies

1 participant