Function pact_mock_server_ffi::message_with_contents [−][src]
#[no_mangle] pub extern "C" fn message_with_contents(
message: MessageHandle,
content_type: *const c_char,
body: *const u8,
size: size_t
)
Expand description
Adds the contents of the Message.
Accepts JSON, binary and other payload types. Binary data will be base64 encoded when serialised.
Note: For text bodies (plain text, JSON or XML), you can pass in a C string (NULL terminated) and the size of the body is not required (it will be ignored). For binary bodies, you need to specify the number of bytes in the body.
content_type
- The content type of the body. Defaults totext/plain
, supports JSON structures with matchers and binary data.body
- The body contents as bytes. For text payloads (JSON, XML, etc.), a C string can be used and matching rules can be embedded in the body.content_type
- Expected content type (e.g. application/json, application/octet-stream)size
- number of bytes in the message body to read. This is not required for text bodies (JSON, XML, etc.).