MCPcopy Create free account
hub / github.com/apache/arrow-rs / set_request_headers

Method set_request_headers

arrow-flight/src/sql/client.rs:449–466  ·  view source on GitHub ↗
(&self, mut req: tonic::Request<M>)

Source from the content-addressed store, hash-verified

447 }
448
449 fn set_request_headers<M>(&self, mut req: tonic::Request<M>) -> Result<tonic::Request<M>> {
450 for (k, v) in &self.headers {
451 let k = AsciiMetadataKey::from_str(k.as_str()).map_err(|e| {
452 ArrowError::ParseError(format!("Cannot convert header key \"{k}\": {e}"))
453 })?;
454 let v = v.parse().map_err(|e| {
455 ArrowError::ParseError(format!("Cannot convert header value \"{v}\": {e}"))
456 })?;
457 req.metadata_mut().insert(k, v);
458 }
459 if let Some(token) = &self.token {
460 let val = format!("Bearer {token}").parse().map_err(|e| {
461 ArrowError::ParseError(format!("Cannot convert token to header value: {e}"))
462 })?;
463 req.metadata_mut().insert("authorization", val);
464 }
465 Ok(req)
466 }
467}
468
469impl<T: Clone> Clone for FlightSqlServiceClient<T> {

Callers 10

handshakeMethod · 0.80
execute_updateMethod · 0.80
execute_ingestMethod · 0.80
do_getMethod · 0.80
do_putMethod · 0.80
do_actionMethod · 0.80
prepareMethod · 0.80
begin_transactionMethod · 0.80
end_transactionMethod · 0.80

Calls 4

as_strMethod · 0.45
parseMethod · 0.45
insertMethod · 0.45
metadata_mutMethod · 0.45

Tested by

no test coverage detected