pub struct DeniedHttpResponseBuilder { /* private fields */ }Expand description
Provides convenient associated fn’s and methods used to build a
pb::DeniedHttpResponse, containing HTTP attributes for a
denied response.
Implementations§
Source§impl DeniedHttpResponseBuilder
impl DeniedHttpResponseBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new, empty DeniedHttpResponseBuilder.
Sourcepub fn set_http_status(&mut self, http_status_code: HttpStatusCode) -> &mut Self
pub fn set_http_status(&mut self, http_status_code: HttpStatusCode) -> &mut Self
Set the HTTP response status code that will be sent to the downstream client.
If not set, Envoy will send a 403 Forbidden HTTP status code.
Sourcepub fn add_header(
&mut self,
key: impl Into<String>,
value: impl Into<String>,
append_action: Option<HeaderAppendAction>,
keep_empty_value: bool,
) -> &mut Self
pub fn add_header( &mut self, key: impl Into<String>, value: impl Into<String>, append_action: Option<HeaderAppendAction>, keep_empty_value: bool, ) -> &mut Self
Add a HTTP response header that will be sent to the downstream client.
The append_action field describes what action should be taken to
append/overwrite the given value for an existing header, or to only
add this header if it is not already present. Defaults to
pb::HeaderAppendAction::AppendIfExistsOrAdd if set as None.
If keep_empty_value is set as false, custom headers with empty
values will be dropped. If set to true, they will be added.
Sourcepub fn set_body(&mut self, body: impl Into<String>) -> &mut Self
pub fn set_body(&mut self, body: impl Into<String>) -> &mut Self
Set the HTTP response body that will be sent to the downstream client.
Sourcepub fn get_http_status(&self) -> &Option<HttpStatus>
pub fn get_http_status(&self) -> &Option<HttpStatus>
Get reference to status.
Sourcepub fn get_headers(&self) -> &Vec<HeaderValueOption>
pub fn get_headers(&self) -> &Vec<HeaderValueOption>
Get reference to headers.
Sourcepub fn build(self) -> DeniedHttpResponse
pub fn build(self) -> DeniedHttpResponse
Build a pb::DeniedHttpResponse, consuming the
DeniedHttpResponseBuilder.
Trait Implementations§
Source§impl Debug for DeniedHttpResponseBuilder
impl Debug for DeniedHttpResponseBuilder
Source§impl Default for DeniedHttpResponseBuilder
impl Default for DeniedHttpResponseBuilder
Source§fn default() -> DeniedHttpResponseBuilder
fn default() -> DeniedHttpResponseBuilder
Source§impl From<DeniedHttpResponseBuilder> for DeniedHttpResponse
impl From<DeniedHttpResponseBuilder> for DeniedHttpResponse
Source§fn from(val: DeniedHttpResponseBuilder) -> Self
fn from(val: DeniedHttpResponseBuilder) -> Self
Source§impl ToHttpResponse for DeniedHttpResponseBuilder
impl ToHttpResponse for DeniedHttpResponseBuilder
fn to_http_response(self) -> HttpResponse
Auto Trait Implementations§
impl Freeze for DeniedHttpResponseBuilder
impl RefUnwindSafe for DeniedHttpResponseBuilder
impl Send for DeniedHttpResponseBuilder
impl Sync for DeniedHttpResponseBuilder
impl Unpin for DeniedHttpResponseBuilder
impl UnwindSafe for DeniedHttpResponseBuilder
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
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