Skip to content

Commit

Permalink
wip: update c types for message bodies to return int (bool)
Browse files Browse the repository at this point in the history
  • Loading branch information
mefellows committed Aug 21, 2022
1 parent e67d374 commit 007ebca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions internal/native/message_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ void pactffi_sync_message_set_response_contents(InteractionHandle *message, size
void pactffi_sync_message_set_response_contents_bin(InteractionHandle *message, size_t index, const unsigned char *contents, size_t len, const char *content_type);
// Can be used instead of the above as a general abstraction for non-binary bodies
bool pactffi_with_body(InteractionHandle interaction, int interaction_part, const char *content_type, const char *body);
int pactffi_with_body(InteractionHandle interaction, int interaction_part, const char *content_type, const char *body);
// Can be used instead of the above as a general abstraction for binary bodies
bool pactffi_with_binary_file(InteractionHandle interaction, int interaction_part, const char *content_type, const uint8_t *body, size_t size);
int pactffi_with_binary_file(InteractionHandle interaction, int interaction_part, const char *content_type, const uint8_t *body, size_t size);
*/
import "C"

Expand Down Expand Up @@ -259,7 +259,7 @@ func (m *Message) WithRequestBinaryContents(body []byte) *Message {
// TODO: handle response
res := C.pactffi_with_binary_file(m.handle, C.int(INTERACTION_PART_REQUEST), cHeader, (*C.char)(unsafe.Pointer(&body[0])), C.int(len(body)))

log.Println("[DEBUG] WithRequestBinaryContents - pactffi_with_binary_file returned", res)
log.Println("[DEBUG] WithRequestBinaryContents - pactffi_with_binary_file returned", int(res))

return m
}
Expand All @@ -270,7 +270,7 @@ func (m *Message) WithRequestBinaryContentType(contentType string, body []byte)
// TODO: handle response
res := C.pactffi_with_binary_file(m.handle, C.int(INTERACTION_PART_REQUEST), cHeader, (*C.char)(unsafe.Pointer(&body[0])), C.int(len(body)))

log.Println("[DEBUG] WithRequestBinaryContents - pactffi_with_binary_file returned", res)
log.Println("[DEBUG] WithRequestBinaryContents - pactffi_with_binary_file returned", int(res))

return m
}
Expand Down
2 changes: 1 addition & 1 deletion internal/native/mock_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void pactffi_with_query_parameter_v2(InteractionHandle interaction, const char *
// https://docs.rs/pact_mock_server_ffi/0.0.7/pact_mock_server_ffi/fn.with_body.html
void pactffi_with_body(InteractionHandle interaction, int interaction_part, const char *content_type, const char *body);
void pactffi_with_binary_file(InteractionHandle interaction, int interaction_part, const char *content_type, const char *body, int size);
int pactffi_with_binary_file(InteractionHandle interaction, int interaction_part, const char *content_type, const char *body, int size);
int pactffi_with_multipart_file(InteractionHandle interaction, int interaction_part, const char *content_type, const char *body, const char *part_name);
Expand Down

0 comments on commit 007ebca

Please sign in to comment.