-
Notifications
You must be signed in to change notification settings - Fork 144
Description
Hello guys!
Maybe an observation from my side: it is not clear for my side if multipart/form-data is supported in v3--> can we prepare an interaction using with_multipart_file and something else ?
I don't know how to attach a body as part in my multipart.
See this test for instance using only with_multipart_fileAny clue ?
Thanks!!
Olivier
Originally posted by @opicaud in #307
Hi! I encountered the same issue that Olivier mentioned. It's unclear to me how to use with_multipart_file while also including additional fields in the body. I have a case where my endpoint expects both a file and a text field in the request body, for example:
{
"text": "text_value",
"file": "video.mp4"
}
I tried doing it like this:
.with_request(method="POST", path="/api/v1/check/")
.with_body(
body={
"text": "text_value",
},
content_type="multipart/form-data",
part="Request"
)
.with_multipart_file(
part_name="file",
path="fixtures/video.mp4",
content_type="video/mp4",
part="Request"
)
.will_respond_with(status=200)
I can't find an example of using it this way. Is it even possible to do that? In the example given above, when the test is triggered on the provider side, my service responds that the "text": "text_value" field is missing in the request.
Thanks in advance,
Jakub