Skip to content

Commit 265660a

Browse files
authored
Show HTTP 400 body also if not structured like ErrorInfo (#54)
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."
1 parent 836e018 commit 265660a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/clients/request_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub fn parse_response(response_status: StatusCode, body: Vec<u8>) -> Result<(),
8686
Ok(body_str) => match serde_json::from_str::<ErrorInfo>(&body_str) {
8787
Ok(error_info) => Err(WebPushError::BadRequest(Some(error_info.error))),
8888
Err(_) if body_str.is_empty() => Err(WebPushError::BadRequest(None)),
89-
Err(_) => Err(WebPushError::BadRequest(None)),
89+
Err(_) => Err(WebPushError::BadRequest(Some(body_str))),
9090
},
9191
},
9292

0 commit comments

Comments
 (0)