feat(client): Response.status() now returns a StatusCode
Previously, it would return `&StatusCode`. Returning a reference was actually bigger than the enum itself, and prevented using `Into` on the return result directly. BREAKING CHANGE: If you were explicitly checking the status, such as with an equality comparison, you will need to use the value instead of a reference.
This commit is contained in:
@@ -37,14 +37,14 @@ impl Request {
|
||||
|
||||
/// The version of HTTP for this request.
|
||||
#[inline]
|
||||
pub fn version(&self) -> &HttpVersion { &self.version }
|
||||
pub fn version(&self) -> HttpVersion { self.version }
|
||||
|
||||
/// The remote socket address of this request
|
||||
///
|
||||
/// This is an `Option`, because some underlying transports may not have
|
||||
/// a socket address, such as Unix Sockets.
|
||||
#[inline]
|
||||
pub fn remote_addr(&self) -> Option<&SocketAddr> { self.remote_addr.as_ref() }
|
||||
pub fn remote_addr(&self) -> Option<SocketAddr> { self.remote_addr }
|
||||
|
||||
/// The target path of this Request.
|
||||
#[inline]
|
||||
|
||||
@@ -26,13 +26,13 @@ impl<B> Response<B> {
|
||||
|
||||
/// The status of this response.
|
||||
#[inline]
|
||||
pub fn status(&self) -> &StatusCode {
|
||||
&self.head.subject
|
||||
pub fn status(&self) -> StatusCode {
|
||||
self.head.subject
|
||||
}
|
||||
|
||||
/// The HTTP version of this response.
|
||||
#[inline]
|
||||
pub fn version(&self) -> &version::HttpVersion { &self.head.version }
|
||||
pub fn version(&self) -> version::HttpVersion { self.head.version }
|
||||
|
||||
/// Get a mutable reference to the Headers.
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user