Closed antiphoton closed 1 year ago
The old function validate_accept_header has been doing two tasks
validate_accept_header
q
This PR decouples the two tasks.
Diff in production code
- assert!(validate_accept_header(s, required).is_ok()); + let actual = parse_accept_value(s); + assert!(actual >= required);
Diff in testing code
- assert!(validate_accept_header(s, PrefersSxg).is_ok()); - assert!(validate_accept_header(s, AcceptsSxg).is_ok()); + assert_eq!(parse_accept_level(s), PrefersSxg);
- assert!(validate_accept_header(s, PrefersSxg).is_err()); - assert!(validate_accept_header(s, AcceptsSxg).is_ok()); + assert_eq!(parse_accept_level(s), AcceptsSxg);
The old function
validate_accept_header
has been doing two tasksq
value of SXG content typeq
value meets the requirements.This PR decouples the two tasks.
Diff in production code
Diff in testing code