pub struct DnsResponse {
pub answer_records: Option<Vec<DnsRecord>>,
pub authority_records: Option<Vec<DnsRecord>>,
pub additional_records: Option<Vec<DnsRecord>>,
pub response_code: Option<String>,
pub delay: Option<Delay>,
pub primary: Option<bool>,
pub extra: Extra,
}Expand description
Builder for a DNS response action.
Serialized as the dnsResponse action in an expectation.
§Example
use mockserver_client::{DnsResponse, DnsRecord};
let dns = DnsResponse::new()
.response_code("NOERROR")
.answer_record(DnsRecord::a("example.com", "1.2.3.4").ttl(300));Fields§
§answer_records: Option<Vec<DnsRecord>>§additional_records: Option<Vec<DnsRecord>>§response_code: Option<String>§delay: Option<Delay>§primary: Option<bool>§extra: ExtraCatch-all for server fields this client does not model yet, so a retrieve -> re-submit cycle cannot silently destroy them.
Implementations§
Source§impl DnsResponse
impl DnsResponse
Sourcepub fn answer_record(self, record: DnsRecord) -> Self
pub fn answer_record(self, record: DnsRecord) -> Self
Append an answer-section record.
Sourcepub fn answer_records(self, records: Vec<DnsRecord>) -> Self
pub fn answer_records(self, records: Vec<DnsRecord>) -> Self
Replace all answer-section records.
Append an authority-section record.
Sourcepub fn additional_record(self, record: DnsRecord) -> Self
pub fn additional_record(self, record: DnsRecord) -> Self
Append an additional-section record.
Sourcepub fn response_code(self, code: impl Into<String>) -> Self
pub fn response_code(self, code: impl Into<String>) -> Self
Set the DNS response code (e.g. “NOERROR”, “NXDOMAIN”, “SERVFAIL”).
Trait Implementations§
Source§impl Clone for DnsResponse
impl Clone for DnsResponse
Source§fn clone(&self) -> DnsResponse
fn clone(&self) -> DnsResponse
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DnsResponse
impl Debug for DnsResponse
Source§impl Default for DnsResponse
impl Default for DnsResponse
Source§fn default() -> DnsResponse
fn default() -> DnsResponse
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DnsResponse
impl<'de> Deserialize<'de> for DnsResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for DnsResponse
impl PartialEq for DnsResponse
Source§impl Serialize for DnsResponse
impl Serialize for DnsResponse
impl StructuralPartialEq for DnsResponse
Auto Trait Implementations§
impl Freeze for DnsResponse
impl RefUnwindSafe for DnsResponse
impl Send for DnsResponse
impl Sync for DnsResponse
impl Unpin for DnsResponse
impl UnsafeUnpin for DnsResponse
impl UnwindSafe for DnsResponse
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