diff --git a/http/src/conn.rs b/http/src/conn.rs index 514d995194..d9c1807632 100644 --- a/http/src/conn.rs +++ b/http/src/conn.rs @@ -22,7 +22,8 @@ use std::{ time::{Instant, SystemTime}, }; -const SERVER: &str = concat!("trillium/", env!("CARGO_PKG_VERSION")); +/// Default Server header +pub const SERVER: &str = concat!("trillium/", env!("CARGO_PKG_VERSION")); /** A http connection diff --git a/http/src/lib.rs b/http/src/lib.rs index cbe4e411bd..60dc1f5dd7 100644 --- a/http/src/lib.rs +++ b/http/src/lib.rs @@ -80,7 +80,7 @@ mod error; pub use error::{Error, Result}; mod conn; -pub use conn::Conn; +pub use conn::{Conn, SERVER}; mod connection_status; pub use connection_status::ConnectionStatus; diff --git a/http/tests/one_hundred_continue.rs b/http/tests/one_hundred_continue.rs index fb18b695aa..8080c4fae5 100644 --- a/http/tests/one_hundred_continue.rs +++ b/http/tests/one_hundred_continue.rs @@ -2,7 +2,7 @@ use indoc::{formatdoc, indoc}; use pretty_assertions::assert_eq; use stopper::Stopper; use test_harness::test; -use trillium_http::{Conn, KnownHeaderName}; +use trillium_http::{Conn, KnownHeaderName, SERVER}; use trillium_testing::{harness, TestResult, TestTransport}; const TEST_DATE: &'static str = "Tue, 21 Nov 2023 21:27:21 GMT"; @@ -43,7 +43,7 @@ async fn one_hundred_continue() -> TestResult { let expected_response = formatdoc! {" HTTP/1.1 200 OK\r - Server: trillium/0.3.5\r + Server: {SERVER}\r Date: {TEST_DATE}\r Connection: close\r Content-Length: 20\r @@ -76,7 +76,7 @@ async fn one_hundred_continue_http_one_dot_zero() -> TestResult { let expected_response = formatdoc! {" HTTP/1.0 200 OK\r - Server: trillium/0.3.5\r + Server: {SERVER}\r Date: {TEST_DATE}\r Connection: close\r Content-Length: 20\r