Struct noir::HttpBody [] [src]

pub struct HttpBody {
    // some fields omitted
}

An abstraction over different data types used for HTTP request bodies.

Trait Implementations

impl From<Vec<u8>> for HttpBody
[src]

fn from(vec: Vec<u8>) -> HttpBody

Creates a HTTP body from a byte vector.

Test Failure Examples

From test_body_expected_raw_mismatch ()

Response Failure: POST request to "http://localhost:4000/echo" returned 1 error(s)   1) Response raw body data does not match, expected the following 16 bytes:   [0x67, 0x08, 0x90, 0xCA, 0xD4, 0xE5, 0xF4, 0x89, 0x00, 0xA0, 0xFF, 0x80, 0x45, 0x13, 0x21, 0x78]   but got the following 16 bytes instead:   [0x00, 0xA0, 0xFF, 0x80, 0x45, 0x13, 0x21, 0x78, 0x67, 0x08, 0x90, 0xCA, 0xD4, 0xE5, 0xF4, 0x89]

impl From<&'static str> for HttpBody
[src]

fn from(string: &'static str) -> HttpBody

Creates a HTTP body from a string slice.

Test Failure Examples

From test_body_text_mismatch_diff_added ()

Response Failure: GET request to "http://localhost:4000/get/hello" returned 1 error(s)   1) Response text body does not match, expected:   "Hello \n"   but got:   "Hello World"   difference:   "Hello World \n"

impl From<String> for HttpBody
[src]

fn from(string: String) -> HttpBody

Creates a HTTP body from a String.

Test Failure Examples

From test_body_text_mismatch_diff_removed ()

Response Failure: GET request to "http://localhost:4000/get/hello" returned 1 error(s)   1) Response text body does not match, expected:   "Hello World Message\n"   but got:   "Hello World"   difference:   "Hello World Message\n"

impl From<JsonValue> for HttpBody
[src]

fn from(json: JsonValue) -> HttpBody

Creates a HTTP body from a JSON value.

Test Failure Examples

From test_body_with_expected_json_mismatch ()

Response Failure: POST request to "http://localhost:4000/echo" returned 1 error(s)   1) Response body JSON does not match:   - json.key: String does not match, expected:   "different value"   but got:   "value"   difference:   "different value"   - json.list: Array with 2 item(s) does not match expected length of 3   - json.some.very.deeply.nested.array: Array with 3 item(s) does not match expected length of 2   - json.some.very.deeply.nested.array[0]: Boolean (false) does not match expected value (true)   - json.some.very.deeply.nested.array[1]: Boolean (true) does not match expected value (false)   - json: Object is missing 1 key(s) (missing)

impl From<HttpFormData> for HttpBody
[src]

fn from(form: HttpFormData) -> HttpBody

Creates a HTTP body from form data.

Test Failure Examples

From test_provided_response_with_expected_body_form_mismatch ()

Response Failure: POST request to "http://localhost:4000/response/forward" returned 1 error(s)   1) Request Failure: POST response provided for "https://example.com/forward" returned 1 error(s)   1.1) Request body form data does not match:   - form.array[]: Array with 4 item(s) does not match expected length of 5   - form.array[][3]: ArrayItem value does not match, expected:   "5\n"   but got:   "4"   difference:   "5\n 4"   - form.field: Field value does not match, expected:   "different someValue\n"   but got:   "someValue\n"   difference:   "different someValue\n"   - form.mismatchedType: Field value does not match, expected:   "array"   but got:   "plain"   difference:   "array plain"   - form.str_file: MIME type (text/html) does not match expected value (text/plain)   - form.vec_file: Filename ("other.bin") does not match expected value ("file.bin")   - form: Is missing 1 plain field(s) (missingField)