Skip to content

Commit

Permalink
Show HTTP 400 body also if not structured like ErrorInfo (#54)
Browse files Browse the repository at this point in the history
Has proven useful to figure out an fcm quirk, where I got as text:
"invalid urgency header defined. Valid options are: high, normal and low."
  • Loading branch information
niklasf authored Dec 23, 2023
1 parent 836e018 commit 265660a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/clients/request_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn parse_response(response_status: StatusCode, body: Vec<u8>) -> Result<(),
Ok(body_str) => match serde_json::from_str::<ErrorInfo>(&body_str) {
Ok(error_info) => Err(WebPushError::BadRequest(Some(error_info.error))),
Err(_) if body_str.is_empty() => Err(WebPushError::BadRequest(None)),
Err(_) => Err(WebPushError::BadRequest(None)),
Err(_) => Err(WebPushError::BadRequest(Some(body_str))),
},
},

Expand Down

0 comments on commit 265660a

Please sign in to comment.