Skip to content

fix: improve Rust quality and expose more things through Adaptors#6

Open
reneca wants to merge 3 commits intomainfrom
improvements
Open

fix: improve Rust quality and expose more things through Adaptors#6
reneca wants to merge 3 commits intomainfrom
improvements

Conversation

@reneca
Copy link
Contributor

@reneca reneca commented Mar 15, 2026

No description provided.

Signed-off-by: Jeremy HERGAULT <jeremy@hergault.fr>
@reneca reneca requested review from Timmy80 and oschijns March 15, 2026 16:14
@reneca reneca self-assigned this Mar 15, 2026
@reneca reneca added the enhancement New feature or request label Mar 15, 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(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

reneca added 2 commits March 17, 2026 10:19
Signed-off-by: Jeremy HERGAULT <jeremy.hergault@worldline.com>
Signed-off-by: Jeremy HERGAULT <jeremy.hergault@worldline.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants