Skip to content

Commit 3b0407f

Browse files
committed
Response: add set_error()
This has been has somewhat controversial in the development of #174 but was ultimately deemed as desirable due to the idea of giving preference to an existing Response rather than creating a new one in upstream libraries.
1 parent 6e04e91 commit 3b0407f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/response.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,11 @@ impl Response {
483483
self.error.take()
484484
}
485485

486+
/// Sets an `Error` on the response, accessible via `error()` and `take_error()`.
487+
pub fn set_error(&mut self, error: Error) {
488+
self.error = Some(error);
489+
}
490+
486491
/// Get the HTTP version, if one has been set.
487492
///
488493
/// # Examples

0 commit comments

Comments
 (0)