-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #260 from pyfisch/rheaders
refactor(headers): export all headers and utils directly under header
- Loading branch information
Showing
37 changed files
with
224 additions
and
273 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
use header::{self, shared}; | ||
use header::{self, Encoding, QualityItem}; | ||
|
||
/// The `Accept-Encoding` header | ||
/// | ||
/// The `Accept-Encoding` header can be used by clients to indicate what | ||
/// response encodings they accept. | ||
#[derive(Clone, PartialEq, Show)] | ||
pub struct AcceptEncoding(pub Vec<shared::QualityItem<shared::Encoding>>); | ||
pub struct AcceptEncoding(pub Vec<QualityItem<Encoding>>); | ||
|
||
impl_list_header!(AcceptEncoding, | ||
"Accept-Encoding", | ||
Vec<shared::QualityItem<shared::Encoding>>); | ||
Vec<QualityItem<Encoding>>); | ||
|
||
#[test] | ||
fn test_parse_header() { | ||
let a: AcceptEncoding = header::Header::parse_header([b"gzip;q=1.0, identity; q=0.5".to_vec()].as_slice()).unwrap(); | ||
let b = AcceptEncoding(vec![ | ||
shared::QualityItem{item: shared::Gzip, quality: 1f32}, | ||
shared::QualityItem{item: shared::Identity, quality: 0.5f32}, | ||
QualityItem{item: Encoding::Gzip, quality: 1f32}, | ||
QualityItem{item: Encoding::Identity, quality: 0.5f32}, | ||
]); | ||
assert_eq!(a, b); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
/// Exposes the AccessControlAllowHeaders header | ||
pub mod allow_headers; | ||
|
||
/// Exposes the AccessControlAllowMethods header | ||
pub mod allow_methods; | ||
|
||
/// Exposes the AccessControlAllowOrigin header | ||
pub mod allow_origin; | ||
|
||
/// Exposes the AccessControlMaxAge header | ||
pub mod max_age; | ||
|
||
/// Exposes the AccessControlRequestHeaders header | ||
pub mod request_headers; | ||
|
||
/// Exposes the AccessControlRequestMethod header | ||
pub mod request_method; | ||
pub use self::allow_headers::AccessControlAllowHeaders; | ||
pub use self::allow_methods::AccessControlAllowMethods; | ||
pub use self::allow_origin::AccessControlAllowOrigin; | ||
pub use self::max_age::AccessControlMaxAge; | ||
pub use self::request_headers::AccessControlRequestHeaders; | ||
pub use self::request_method::AccessControlRequestMethod; | ||
|
||
mod allow_headers; | ||
mod allow_methods; | ||
mod allow_origin; | ||
mod max_age; | ||
mod request_headers; | ||
mod request_method; |
This file contains 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
Oops, something went wrong.