#[non_exhaustive]pub struct ServerOptions {
pub path: String,
pub cors: CorsOptions,
pub health_endpoint: bool,
}Available on crate feature
server only.Expand description
Configuration for an AcpHttpServer.
Start with Self::default and use the fluent setters to customize it.
Fields remain public for reading and mutation, but this type is non-exhaustive
so new options can be added without breaking callers.
use agent_client_protocol_http::{CorsOptions, ServerOptions};
let options = ServerOptions::default()
.with_path("/agent")
.with_cors(CorsOptions::allow_origins(["https://example.com"])?)
.with_health_endpoint(false);
assert_eq!(options.path, "/agent");
assert!(!options.health_endpoint);Struct literals, including struct update syntax, are not supported outside this crate:
ⓘ
use agent_client_protocol_http::ServerOptions;
let options = ServerOptions {
path: "/agent".into(),
..ServerOptions::default()
};Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.path: StringACP endpoint path. Defaults to /acp.
cors: CorsOptionsBrowser origin policy. Defaults to CorsOptions::Disabled.
health_endpoint: boolWhether to expose GET /health. Defaults to true.
Implementations§
Source§impl ServerOptions
impl ServerOptions
Sourcepub fn with_cors(self, cors: CorsOptions) -> Self
pub fn with_cors(self, cors: CorsOptions) -> Self
Set the browser origin policy.
CORS does not authenticate requests. The built-in CORS layer does not
allow the Authorization request header or enable credentialed CORS.
Authentication and custom credential policies belong to the host router.
Sourcepub fn with_health_endpoint(self, enabled: bool) -> Self
pub fn with_health_endpoint(self, enabled: bool) -> Self
Enable or disable the GET /health endpoint.
Trait Implementations§
Source§impl Clone for ServerOptions
impl Clone for ServerOptions
Source§impl Debug for ServerOptions
impl Debug for ServerOptions
Auto Trait Implementations§
impl Freeze for ServerOptions
impl RefUnwindSafe for ServerOptions
impl Send for ServerOptions
impl Sync for ServerOptions
impl Unpin for ServerOptions
impl UnsafeUnpin for ServerOptions
impl UnwindSafe for ServerOptions
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.