MCPcopy Create free account
hub / github.com/apache/dubbo-rust / to_http

Method to_http

dubbo/src/status.rs:284–306  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

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();

Callers 6

poll_trailersMethod · 0.80
client_streamingMethod · 0.80
bidi_streamingMethod · 0.80
server_streamingMethod · 0.80
unaryMethod · 0.80
callMethod · 0.80

Calls 4

empty_bodyFunction · 0.85
into_partsMethod · 0.80
insertMethod · 0.80
to_http_header_valueMethod · 0.80

Tested by

no test coverage detected