reqwasm
reqwasm copied to clipboard
impl PartialEq for reqwasm::http::Method
It can be useful to be able to compare the method of a request, e.g. for implementing some common retry logic:
if method == http::Method::GET && RETRYABLE_STATUSES.contains(&status) {
warn!(
"fetch failed with {}, will retry in {:?}",
status, RETRY_DELAY
);
// ... retry the request
}
At the moment this fails because there is no PartialEq
impl for reqwasm::http::Method
, so you have to use matches!
which is not so ergonomic when it's an enum with no associated data anyway.
Would you like to PR this change?
Yup absolutely, just wanted to make sure the impl wasn't left off for a reason. Will send a PR shortly!