Skip to main content

Spec

Struct Spec 

Source
pub struct Spec {
Show 15 fields pub auth_b64: Option<String>, pub partial_first_put: Option<usize>, pub cut_first_get: Option<(usize, bool)>, pub drip: Option<Drip>, pub sizeless: bool, pub rate_first: Option<(usize, u64)>, pub flaky_first: Option<u32>, pub pause_first_503: Option<u64>, pub ignore_range: bool, pub markerless: bool, pub foreign_marker: bool, pub read_only: bool, pub redirect: Option<String>, pub drop_connection: bool, pub freeze_upload: bool,
}
Expand description

The composable behavior of one hosted instance.

Fields§

§auth_b64: Option<String>

Basic-auth gate: the expected Authorization token, base64 of user:pass.

§partial_first_put: Option<usize>

Cut the first PUT per path after this many body bytes.

§cut_first_get: Option<(usize, bool)>

Cut the first success GET per path: (body bytes, lie about Content-Length).

§drip: Option<Drip>

Answer GET/HEAD bodies in delayed chunks.

§sizeless: bool

Success GET/HEAD answers hide Content-Length.

§rate_first: Option<(usize, u64)>

The first N requests per path answer 429 with a Retry-After of this many seconds.

§flaky_first: Option<u32>

The first N requests per path answer 503.

§pause_first_503: Option<u64>

The first request per path answers 503 with a Retry-After of this many seconds.

§ignore_range: bool

Refuse every ranged GET with the whole body (200).

§markerless: bool

Drop markers instead of storing them.

§foreign_marker: bool

Replace marker digests with zeros.

§read_only: bool

Refuse every DELETE.

§redirect: Option<String>

Redirect reads to this path with an empty 301.

§drop_connection: bool

Reset the first request per path.

§freeze_upload: bool

Hold PUT connections without reading or answering.

Implementations§

Source§

impl Spec

Source

pub fn atomic() -> Self

The spec of a plain correct server.

Source

pub fn with_auth(self, user: &str, pass: &str) -> Self

A Basic-auth gate from plain credentials.

Source

pub fn with_partial_put(self, bytes: usize) -> Self

Cut the first PUT per path after bytes body bytes.

Source

pub fn with_cut_body(self, bytes: usize, fake_length: bool) -> Self

Cut the first success GET per path after bytes body bytes, optionally lying about Content-Length.

Source

pub fn with_drip(self, delay_ms: u64, chunk_size: usize) -> Self

Serve GET/HEAD bodies in delayed chunks.

Source

pub fn with_sizeless(self) -> Self

Hide Content-Length on success GET/HEAD answers.

Source

pub fn with_rate_limit(self, n: usize, retry_after_secs: u64) -> Self

Answer the first n requests per path with 429 and this Retry-After.

Source

pub fn with_flaky(self, n: u32) -> Self

Answer the first n requests per path with 503.

Source

pub fn with_retry_after_503(self, retry_after_secs: u64) -> Self

Answer the first request per path with 503 and this Retry-After.

Source

pub fn with_ignore_range(self) -> Self

Answer every ranged GET with the whole body.

Source

pub fn with_markerless(self) -> Self

Drop .sha256 PUTs instead of storing them.

Source

pub fn with_foreign_marker(self) -> Self

Zero out every stored marker’s digest.

Source

pub fn with_read_only(self) -> Self

Refuse every DELETE with 403.

Source

pub fn with_redirect(self, location_path: &str) -> Self

Redirect every read to this path with an empty 301.

Source

pub fn with_drop_connection(self) -> Self

Reset the first request per path right after its head.

Source

pub fn with_freeze_upload(self) -> Self

Hold PUT connections without reading or answering.

Trait Implementations§

Source§

impl Clone for Spec

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Spec

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Spec

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl From<&Scenario> for Spec

Source§

fn from(scenario: &Scenario) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Spec

§

impl RefUnwindSafe for Spec

§

impl Send for Spec

§

impl Sync for Spec

§

impl Unpin for Spec

§

impl UnsafeUnpin for Spec

§

impl UnwindSafe for Spec

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.