(&self)
| 282 | } |
| 283 | |
| 284 | pub fn to_http(&self) -> http::Response<crate::BoxBody> { |
| 285 | let (mut parts, _) = http::Response::new(()).into_parts(); |
| 286 | |
| 287 | parts.headers.insert( |
| 288 | http::header::CONTENT_TYPE, |
| 289 | http::HeaderValue::from_static("application/grpc"), |
| 290 | ); |
| 291 | |
| 292 | parts |
| 293 | .headers |
| 294 | .insert(GRPC_STATUS, self.code.to_http_header_value()); |
| 295 | parts.headers.insert( |
| 296 | GRPC_MESSAGE, |
| 297 | http::HeaderValue::from_str(&self.message).unwrap(), |
| 298 | ); |
| 299 | |
| 300 | parts.headers.insert( |
| 301 | "grpc-accept-encoding", |
| 302 | http::HeaderValue::from_static("gzip,identity"), |
| 303 | ); |
| 304 | |
| 305 | http::Response::from_parts(parts, crate::empty_body()) |
| 306 | } |
| 307 | |
| 308 | pub fn to_hyper_body(&self) -> http::Response<hyper::Body> { |
| 309 | let (mut parts, _) = http::Response::new(()).into_parts(); |
no test coverage detected