Function pact_ffi::plugins::pactffi_interaction_contents

source ·
#[no_mangle]
pub extern "C" fn pactffi_interaction_contents(
    interaction: InteractionHandle,
    part: InteractionPart,
    content_type: *const c_char,
    contents: *const c_char
) -> c_uint
Expand description

Setup the interaction part using a plugin. The contents is a JSON string that will be passed on to the plugin to configure the interaction part. Refer to the plugin documentation on the format of the JSON contents.

Returns zero on success, and a positive integer value on failure.

  • interaction - Handle to the interaction to configure.
  • part - The part of the interaction to configure (request or response). It is ignored for messages.
  • content_type - NULL terminated C string of the content type of the part.
  • contents - NULL terminated C string of the JSON contents that gets passed to the plugin.

§Safety

content_type and contents must be a valid pointers to NULL terminated strings. Invalid pointers will result in undefined behaviour.

§Errors

  • 1 - A general panic was caught.
  • 2 - The mock server has already been started.
  • 3 - The interaction handle is invalid.
  • 4 - The content type is not valid.
  • 5 - The contents JSON is not valid JSON.
  • 6 - The plugin returned an error.

When an error errors, LAST_ERROR will contain the error message.