pact-foundation / pact-python

Python version of Pact. Enables consumer driven contract testing, providing a mock service and DSL for the consumer project, and interaction playback and verification for the service provider project.
http://pact.io
MIT License
568 stars 137 forks source link

Document how to do file upload or multipart/form-data #307

Open franz-see opened 2 years ago

franz-see commented 2 years ago

I cannot find any information on how to do file upload with pact-python for consumer test. Kindly advice

pegas511 commented 2 years ago

Faced with the same, it's strange that JVM and JS has the solution to upload multipart and python does not

mefellows commented 2 years ago

It's because the current Ruby core that we use in Python doesn't support it, but the rust core does.

See this doc for how to do it in the meantime: https://docs.pact.io/faq#how-do-i-test-binary-files-in-responses-such-as-a-download

franz-see commented 2 years ago

@mefellows that seems to be binary responses. Not sure how to translate that to binary requests

mefellows commented 2 years ago

The point is to test the headers and things, you can't match the binary contents themselves

On Thu, 22 Sept 2022, 00:52 Franz Allan Valencia See, < @.***> wrote:

@mefellows https://github.com/mefellows that seems to be binary responses. Not sure how to translate that to binary requests

— Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-python/issues/307#issuecomment-1253826744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDGVKGKVOFZMGILLB6TV7MOLNANCNFSM6AAAAAAQR2F2D4 . You are receiving this because you were mentioned.Message ID: @.***>

franz-see commented 2 years ago

@mefellows curious, how come java, .net and js can do it? because they're in rust?

mefellows commented 2 years ago

Yep!

On Thu, 22 Sept 2022, 17:03 Franz Allan Valencia See, < @.***> wrote:

@mefellows https://github.com/mefellows curious, how come java, .net and js can do it? because they're in rust?

— Reply to this email directly, view it on GitHub https://github.com/pact-foundation/pact-python/issues/307#issuecomment-1254613205, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAANFDDJMTVE42C7SBGTXI3V7QAEHANCNFSM6AAAAAAQR2F2D4 . You are receiving this because you were mentioned.Message ID: @.***>