fix: improve Rust quality and expose more things through Adaptors#6
Open
fix: improve Rust quality and expose more things through Adaptors#6
Conversation
Signed-off-by: Jeremy HERGAULT <jeremy@hergault.fr>
oschijns
reviewed
Mar 16, 2026
Comment on lines
+55
to
+69
| "/" => Response::builder() | ||
| .header( | ||
| "Server", | ||
| <HyperDemoAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER, | ||
| ) | ||
| .body(BoxBody::new(Full::new(Bytes::from(format!( | ||
| "{} - Home of {}", | ||
| if req.version() == hyper::Version::HTTP_2 { | ||
| "H2" | ||
| } else { | ||
| "HTTP/1.1" | ||
| }, | ||
| self.prosa_name, | ||
| ))))) | ||
| .into(), |
Collaborator
There was a problem hiding this comment.
Suggested change
| "/" => Response::builder() | |
| .header( | |
| "Server", | |
| <HyperDemoAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER, | |
| ) | |
| .body(BoxBody::new(Full::new(Bytes::from(format!( | |
| "{} - Home of {}", | |
| if req.version() == hyper::Version::HTTP_2 { | |
| "H2" | |
| } else { | |
| "HTTP/1.1" | |
| }, | |
| self.prosa_name, | |
| ))))) | |
| .into(), | |
| "/" => { | |
| let header = <HyperDemoAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER; | |
| let version = if req.version() == hyper::Version::HTTP_2 { | |
| "H2" | |
| } else { | |
| "HTTP/1.1" | |
| }; | |
| Response::builder() | |
| .header("Server", header) | |
| .body(BoxBody::new(Full::new(Bytes::from(format!( | |
| "{} - Home of {}", | |
| version, self.prosa_name, | |
| ))))) | |
| .into() | |
| } |
Comment on lines
+76
to
+83
| _ => Response::builder() | ||
| .status(404) | ||
| .header( | ||
| "Server", | ||
| <HyperDemoAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER, | ||
| ) | ||
| .body(BoxBody::new(Full::new(Bytes::from("Not Found")))) | ||
| .into(), |
Collaborator
There was a problem hiding this comment.
Suggested change
| _ => Response::builder() | |
| .status(404) | |
| .header( | |
| "Server", | |
| <HyperDemoAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER, | |
| ) | |
| .body(BoxBody::new(Full::new(Bytes::from("Not Found")))) | |
| .into(), | |
| _ => { | |
| let header = <HyperDemoAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER; | |
| Response::builder() | |
| .status(404) | |
| .header("Server", header) | |
| .body(BoxBody::new(Full::new(Bytes::from("Not Found")))) | |
| .into() | |
| } |
Comment on lines
+134
to
+141
| Response::builder() | ||
| .status(200) | ||
| .header( | ||
| "Server", | ||
| <HelloHyperServerAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER, | ||
| ) | ||
| .body(BoxBody::new(Full::new(Bytes::from(self.hello_msg.clone())))) | ||
| .into() |
Collaborator
There was a problem hiding this comment.
Suggested change
| Response::builder() | |
| .status(200) | |
| .header( | |
| "Server", | |
| <HelloHyperServerAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER, | |
| ) | |
| .body(BoxBody::new(Full::new(Bytes::from(self.hello_msg.clone())))) | |
| .into() | |
| let header = <HelloHyperServerAdaptor as HyperServerAdaptor<M>>::SERVER_HEADER; | |
| Response::builder() | |
| .status(200) | |
| .header("Server", header) | |
| .body(BoxBody::new(Full::new(Bytes::from(self.hello_msg.clone())))) | |
| .into() |
Signed-off-by: Jeremy HERGAULT <jeremy.hergault@worldline.com>
Signed-off-by: Jeremy HERGAULT <jeremy.hergault@worldline.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.