Bump dependencies
This commit is contained in:
@@ -379,7 +379,9 @@ mod tests {
|
||||
fn rate_limit_headers_match_spec() {
|
||||
// Spec example: RateLimit-Policy: "burst";q=100;w=60,"daily";q=1000;w=86400
|
||||
let mut p1 = String::new();
|
||||
RateLimitPolicy::new("burst", 100).with_window(60).fmt_policy(&mut p1);
|
||||
RateLimitPolicy::new("burst", 100)
|
||||
.with_window(60)
|
||||
.fmt_policy(&mut p1);
|
||||
assert_eq!(p1, r#""burst";q=100;w=60"#);
|
||||
|
||||
// Spec example: RateLimit-Policy: "peruser";q=65535;qu="content-bytes";w=10
|
||||
@@ -392,13 +394,24 @@ mod tests {
|
||||
|
||||
// Spec example: RateLimit: "default";r=50;t=30
|
||||
let mut s = String::new();
|
||||
RateLimitPolicy::new("default", 100).with_remaining(50).with_reset(30).fmt_state(&mut s);
|
||||
RateLimitPolicy::new("default", 100)
|
||||
.with_remaining(50)
|
||||
.with_reset(30)
|
||||
.fmt_state(&mut s);
|
||||
assert_eq!(s, r#""default";r=50;t=30"#);
|
||||
|
||||
// Two policies in one header
|
||||
let err = RequestError::too_many_requests()
|
||||
.with_rate_limit(RateLimitPolicy::new("burst", 100).with_window(60).with_reset(30))
|
||||
.with_rate_limit(RateLimitPolicy::new("daily", 1000).with_window(86400).with_reset(3600));
|
||||
.with_rate_limit(
|
||||
RateLimitPolicy::new("burst", 100)
|
||||
.with_window(60)
|
||||
.with_reset(30),
|
||||
)
|
||||
.with_rate_limit(
|
||||
RateLimitPolicy::new("daily", 1000)
|
||||
.with_window(86400)
|
||||
.with_reset(3600),
|
||||
);
|
||||
assert_eq!(
|
||||
err.rate_limit_policy_header().as_deref(),
|
||||
Some(r#""burst";q=100;w=60, "daily";q=1000;w=86400"#),
|
||||
@@ -410,4 +423,3 @@ mod tests {
|
||||
assert_eq!(err.retry_after, Some(3600));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user