pub struct TranscodeOptions { /* private fields */ }Expand description
How routes_with_options builds the transcoded routes.
§Examples
use axum::http::HeaderName;
use structured_proxy::transcode::error::ErrorDetailsPolicy;
use structured_proxy::transcode::TranscodeOptions;
let options = TranscodeOptions::default()
.with_error_details(ErrorDetailsPolicy::default().route("/v1/admin/**", false).unwrap())
.with_ndjson_envelope(true)
.with_denied_response_headers([HeaderName::from_static("x-debug-trace")]);Implementations§
Source§impl TranscodeOptions
impl TranscodeOptions
Sourcepub fn with_selection(self, selection: RpcSelection) -> Self
pub fn with_selection(self, selection: RpcSelection) -> Self
Transcode only the RPCs selection names (every annotated one by
default).
Sourcepub fn with_error_details(self, policy: ErrorDetailsPolicy) -> Self
pub fn with_error_details(self, policy: ErrorDetailsPolicy) -> Self
Which routes return google.rpc.Status details in their error bodies
(all of them by default).
Sourcepub fn with_ndjson_envelope(self, enabled: bool) -> Self
pub fn with_ndjson_envelope(self, enabled: bool) -> Self
Wrap every NDJSON line of a server-streaming response in an envelope:
{"result": <message>} for data, {"error": <error body>} for the
terminal error (the grpc-gateway stream shape). Off by default, when a
data line is the bare message and the error line carries an
@type: google.rpc.Status marker instead. Only the envelope keeps the
two apart for RPCs that stream google.protobuf.Any, Struct, Value
or ListValue, whose messages can carry any keys. SSE is unaffected.
Sourcepub fn with_denied_response_headers(
self,
names: impl IntoIterator<Item = HeaderName>,
) -> Self
pub fn with_denied_response_headers( self, names: impl IntoIterator<Item = HeaderName>, ) -> Self
Response metadata keys that never become HTTP response headers, on top
of gRPC’s own keys, hop-by-hop fields and x-http-code, which never do.
Replaces any list set before. Use it to keep internal headers (debug
traces, backend names) off a public edge; an upstream key not listed
here reaches the client.
Trait Implementations§
Source§impl Clone for TranscodeOptions
impl Clone for TranscodeOptions
Source§impl Debug for TranscodeOptions
impl Debug for TranscodeOptions
Auto Trait Implementations§
impl Freeze for TranscodeOptions
impl RefUnwindSafe for TranscodeOptions
impl Send for TranscodeOptions
impl Sync for TranscodeOptions
impl Unpin for TranscodeOptions
impl UnsafeUnpin for TranscodeOptions
impl UnwindSafe for TranscodeOptions
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
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,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request