MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / build_request

Method build_request

src/cloud-api/src/client.rs:100–128  ·  view source on GitHub ↗

Builds a request towards the `Client`'s endpoint

(
        &self,
        method: Method,
        path: P,
        query: Option<&[(&str, &str)]>,
        mut domain: Url,
        headers: Option<HeaderMap>,
    )

Source from the content-addressed store, hash-verified

98
99 /// Builds a request towards the `Client`'s endpoint
100 async fn build_request<P>(
101 &self,
102 method: Method,
103 path: P,
104 query: Option<&[(&str, &str)]>,
105 mut domain: Url,
106 headers: Option<HeaderMap>,
107 ) -> Result<RequestBuilder, Error>
108 where
109 P: IntoIterator,
110 P::Item: AsRef<str>,
111 {
112 domain
113 .path_segments_mut()
114 .or(Err(Error::UrlBaseError))?
115 .clear()
116 .extend(path);
117
118 let mut req = self.inner.request(method, domain);
119 if let Some(header_map) = headers {
120 req = req.headers(header_map);
121 }
122 if let Some(query_params) = query {
123 req = req.query(&query_params);
124 }
125 let token = self.auth_client.auth().await?;
126
127 Ok(req.bearer_auth(token))
128 }
129
130 async fn send_request<T>(&self, req: RequestBuilder) -> Result<T, Error>
131 where

Callers 2

build_global_requestMethod · 0.45
build_region_requestMethod · 0.45

Calls 6

extendMethod · 0.45
clearMethod · 0.45
orMethod · 0.45
headersMethod · 0.45
queryMethod · 0.45
authMethod · 0.45

Tested by

no test coverage detected