Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce http::Request<B> and http::Response<U> for our services #182

Merged
merged 1 commit into from
Nov 22, 2021

Conversation

Nehliin
Copy link
Collaborator

@Nehliin Nehliin commented Nov 22, 2021

Motivation

Fixes: #164 and hopefully makes it less likely to require breaking changes in the future.

@Nehliin Nehliin enabled auto-merge (squash) November 22, 2021 09:19
@Nehliin Nehliin merged commit faa7368 into tower-rs:master Nov 22, 2021
@Nehliin Nehliin deleted the stricter-types branch November 22, 2021 09:26
@davidpdrsn davidpdrsn mentioned this pull request Dec 1, 2021
@privettoli
Copy link
Contributor

privettoli commented Jan 20, 2024

Did we consider using a trait for the request and response to provide http::Request? I need to have a custom request and it seems to be incompatible with the current implementation. Would replacement of http::Request with IntoHttpRequest trait be an acceptable flexible solution?

@jplatte
Copy link
Collaborator

jplatte commented Jan 20, 2024

Please open a new issue for feature requests / discussions, instead of commenting on old PRs.

That said, I don't think this is something we will at. If you need to convert types between two layers, you should be able to do so with another layer. If it's only for request or response, not both, I'd recommend tower's map_request / map_response.

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.

Make sure all middleware implement Service<Request<ReqBody>> and require Response = Response<ResBody>
4 participants