Skip to content

Commit

Permalink
http patch: export and use SERVER header
Browse files Browse the repository at this point in the history
  • Loading branch information
jbr committed Nov 23, 2023
1 parent 858fa5b commit 93ab9e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion http/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions http/tests/one_hundred_continue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 93ab9e9

Please sign in to comment.