pub struct HTTPProxyRegistryWriter { /* private fields */ }Expand description
Register scanned modules as HTTP proxy modules in the registry.
Each module’s execute() sends an HTTP request to the target API
instead of calling the handler directly.
Implementations§
Source§impl HTTPProxyRegistryWriter
impl HTTPProxyRegistryWriter
Sourcepub fn new(
base_url: String,
auth_header_factory: Option<Box<dyn Fn() -> HashMap<String, String> + Send + Sync>>,
timeout_secs: f64,
) -> Result<Self, HTTPProxyRegistryWriterError>
pub fn new( base_url: String, auth_header_factory: Option<Box<dyn Fn() -> HashMap<String, String> + Send + Sync>>, timeout_secs: f64, ) -> Result<Self, HTTPProxyRegistryWriterError>
Create a new HTTP proxy writer.
base_url: Base URL of the target API (must behttp://orhttps://).auth_header_factory: Optional callable returning HTTP headers for auth.timeout_secs: HTTP request timeout in seconds (must be a positive finite number).
§Errors
Returns HTTPProxyRegistryWriterError::InvalidBaseUrl if base_url is not a valid URL
or its scheme is not http or https (SSRF prevention).
Returns HTTPProxyRegistryWriterError::InvalidTimeout if timeout_secs is not a
positive finite number.
Sourcepub fn write(
&self,
modules: &[ScannedModule],
registry: &mut Registry,
) -> Vec<WriteResult>
pub fn write( &self, modules: &[ScannedModule], registry: &mut Registry, ) -> Vec<WriteResult>
Register each ScannedModule as an HTTP proxy module.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HTTPProxyRegistryWriter
impl !RefUnwindSafe for HTTPProxyRegistryWriter
impl Send for HTTPProxyRegistryWriter
impl Sync for HTTPProxyRegistryWriter
impl Unpin for HTTPProxyRegistryWriter
impl UnsafeUnpin for HTTPProxyRegistryWriter
impl !UnwindSafe for HTTPProxyRegistryWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more