Skip to content

Commit

Permalink
chore(ffi): deprecate pactffi_with_binary_file
Browse files Browse the repository at this point in the history
The `pactffi_with_binary_file` is functionally replaced by the
combination of `pactffi_with_binary_body` and
`pactffi_with_matching_ruless`. These two functions should be preferred
over this one.

Furthermore, this function's naming (especially when compared to
`pactffi_with_binary_body`) which might suggest it merely sets the body
by reading a specific binary file.

Signed-off-by: JP-Ellis <[email protected]>
  • Loading branch information
JP-Ellis committed Jul 17, 2024
1 parent bb9fc1b commit 51c6cb0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rust/pact_ffi/src/mock_server/handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,14 @@ pub extern fn pactffi_with_binary_body(
}).unwrap_or(false)
}

/// <div class="warning">
///
/// This function is deprecated. Use [`pactffi_with_binary_body`] in order to
/// set the binary body, and use [`pactffi_with_matching_rules`] to set the
/// matching rules to ensure that only the content type is being matched.
///
/// </div>
///
/// Adds a binary file as the body with the expected content type and example contents. Will use
/// a mime type matcher to match the body. Returns false if the interaction or Pact can't be
/// modified (i.e. the mock server for it has already started)
Expand All @@ -2022,6 +2030,7 @@ pub extern fn pactffi_with_binary_body(
/// Returns false if the interaction or Pact can't be modified (i.e. the mock server for it has
/// already started) or an error has occurred.
#[no_mangle]
#[deprecated(note = "Use `pactffi_with_binary_body` and `pactffi_with_matching_rules` instead")]
pub extern fn pactffi_with_binary_file(
interaction: InteractionHandle,
part: InteractionPart,
Expand Down

0 comments on commit 51c6cb0

Please sign in to comment.