mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-24 16:40:38 +00:00
[local_proxy]: install pg_session_jwt extension on demand (#9370)
Follow up on #9344. We want to install the extension automatically. We didn't want to couple the extension into compute_ctl so instead local_proxy is the one to issue requests specific to the extension. depends on #9344 and #9395
This commit is contained in:
@@ -8,6 +8,7 @@ use std::time::Duration;
|
||||
|
||||
use anyhow::bail;
|
||||
use bytes::Bytes;
|
||||
use http::Method;
|
||||
use http_body_util::BodyExt;
|
||||
use hyper::body::Body;
|
||||
pub(crate) use reqwest::{Request, Response};
|
||||
@@ -93,9 +94,19 @@ impl Endpoint {
|
||||
/// Return a [builder](RequestBuilder) for a `GET` request,
|
||||
/// accepting a closure to modify the url path segments for more complex paths queries.
|
||||
pub(crate) fn get_with_url(&self, f: impl for<'a> FnOnce(&'a mut ApiUrl)) -> RequestBuilder {
|
||||
self.request_with_url(Method::GET, f)
|
||||
}
|
||||
|
||||
/// Return a [builder](RequestBuilder) for a request,
|
||||
/// accepting a closure to modify the url path segments for more complex paths queries.
|
||||
pub(crate) fn request_with_url(
|
||||
&self,
|
||||
method: Method,
|
||||
f: impl for<'a> FnOnce(&'a mut ApiUrl),
|
||||
) -> RequestBuilder {
|
||||
let mut url = self.endpoint.clone();
|
||||
f(&mut url);
|
||||
self.client.get(url.into_inner())
|
||||
self.client.request(method, url.into_inner())
|
||||
}
|
||||
|
||||
/// Execute a [request](reqwest::Request).
|
||||
|
||||
Reference in New Issue
Block a user