refactor(header): make some headers more allocator friendly
Change the internal implementation of some simple headers to make them more allocator friendly. Also add a constructor method to allow changing the implementation in the future again. The headers are: - Location - Referrer - Server - UserAgent This change was suggested in [#1104]. BREAKING CHANGES: - Old code that creates the header structs directly will stop working. - It's not possible to implement DerefMut for a Cow<'static,str>. Code that needs to modify header after creation will stop working.
This commit is contained in:
		| @@ -148,7 +148,7 @@ fn test_get_type() { | ||||
|     use ::header::{ContentLength, UserAgent}; | ||||
|  | ||||
|     let len = ContentLength(5); | ||||
|     let agent = UserAgent("hyper".to_owned()); | ||||
|     let agent = UserAgent::new("hyper"); | ||||
|  | ||||
|     assert_eq!(TypeId::of::<ContentLength>(), len.get_type()); | ||||
|     assert_eq!(TypeId::of::<UserAgent>(), agent.get_type()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user