I am writing a contract test for a post method whe...
# pact-net
p
I am writing a contract test for a post method where I need to pass a file in request Body as 'form-data'. How do I write this in pact interaction. I have tried this but it doesn't work.
m
Is it a multipart json body or something else?
p
It is supposed to be a file, e.g. .txt, .csv etc.
In postman it works when I send the file as form-data
When I select 'form-data' type under body, it automatically adds 'multipart/form-data' header. But the request works even if I remove this header. So I guess its just a question of setting file upload with 'form-data' in pact interaction
m
I ask because you add the body in the JSON method. Is there a different multipart method that can be used as an alternative?
p
you mean in mocked client? I haven't tried anything other than mutlipart yet. I will give it a try
m
yes, I’m saying that you used the JSON body method for a multi-part post. I’m assuming there is (or should be) a specific multi-part content function
the JSON body is unlikely to work properly, because it won’t add the correct multipart request bits
p
I didn't see any multipart content specific function in PactNet4. That would have been really Great. This is all what I see
m
Could you please raise a feature request? I know the core supports multiple and binary payloads, so ideally we support those
p
Oh OK. Can you please direct me where to do that? TA
m
Sorry, on the pact Net GitHub repo pls