Skip to content

feat(rumqttc): Support fallible request modifiers for websocket connections - #1030

Open
michelhe wants to merge 1 commit into
bytebeamio:mainfrom
michelhe:pr/fallible-request-modifiers
Open

feat(rumqttc): Support fallible request modifiers for websocket connections#1030
michelhe wants to merge 1 commit into
bytebeamio:mainfrom
michelhe:pr/fallible-request-modifiers

Conversation

@michelhe

Copy link
Copy Markdown

The set_request_modifier API now accepts closures that return either http::Request<()> (infallible) or Result<http::Request<()>, E> (fallible).

This change is backwards compatible - existing code returning requests directly continues to work unchanged. New code can now use the ? operator and propagate errors instead of using unwrap().

Modifier errors are surfaced as ConnectionError::RequestModifier, allowing proper error handling during connection establishment.

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • Formatted with cargo fmt
  • Make an entry to CHANGELOG.md if it's relevant to the users of the library. If it's not relevant mention why.

…ctions

The set_request_modifier API now accepts closures that return either
`http::Request<()>` (infallible) or `Result<http::Request<()>, E>` (fallible).

This change is backwards compatible - existing code returning requests
directly continues to work unchanged. New code can now use the ? operator
and propagate errors instead of using unwrap().

Modifier errors are surfaced as ConnectionError::RequestModifier, allowing
proper error handling during connection establishment.

Changes:
- Add IntoModifierResult trait for accepting both return types
- Add ConnectionError::RequestModifier variant for error propagation
- Extract shared types into request_modifier module (used by v4 and v5)
- Add documentation with usage examples
- Add unit and integration tests
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