Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to combine with_multipart_file with additional body fields? #1069

Open
Labels
area:coreRelating to the core Pact Python librarysmartbear-supportedThis issue is supported by SmartBeartype:featureNew feature
@jakubpawlik-identt

Description

@jakubpawlik-identt

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_fileand something else ?
I don't know how to attach a body as part in my multipart.
Seethis test for instance using only with_multipart_file

Any 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreRelating to the core Pact Python librarysmartbear-supportedThis issue is supported by SmartBeartype:featureNew feature

    Type

    No type

    Projects

    Status

    📝 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp