feat(entitytag): Add EntityTag comparison, make EntityTag safe to use
Adds strong and weak comparison to EntityTag as described in the RFC,
add tests for this. Make EntityTag safe to use by hiding the tag field,
this prevents users from inserting malicious values for the tag. Invalid
values can screw up header formatting and may allow to insert headers.
Introduce EntityTag::new(), .tag() and .set_tag() methods. Fix Display
trait for EntityTag. DQUOTES were missing. Remove custom formatting in ETag
header. Improve docs.
BREAKING_CHANGE: EntityTag.tag is private, use EntityTag.tag() and
EntityTag.set_tag("foobar") to access it.
			
			
This commit is contained in:
		| @@ -67,14 +67,8 @@ mod tests { | ||||
|  | ||||
|         if_none_match = Header::parse_header([b"\"foobar\", W/\"weak-etag\"".to_vec()].as_ref()); | ||||
|         let mut entities: Vec<EntityTag> = Vec::new(); | ||||
|         let foobar_etag = EntityTag { | ||||
|             weak: false, | ||||
|             tag: "foobar".to_string() | ||||
|         }; | ||||
|         let weak_etag = EntityTag { | ||||
|             weak: true, | ||||
|             tag: "weak-etag".to_string() | ||||
|         }; | ||||
|         let foobar_etag = EntityTag::new(false, "foobar".to_string()); | ||||
|         let weak_etag = EntityTag::new(true, "weak-etag".to_string()); | ||||
|         entities.push(foobar_etag); | ||||
|         entities.push(weak_etag); | ||||
|         assert_eq!(if_none_match, Some(IfNoneMatch::EntityTags(entities))); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user