Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set expectation for contents of a zip file in consumer contract pact #1763

Open
sumitsg004 opened this issue Jan 25, 2024 · 3 comments
Open
Labels
enhancement Indicates new feature requests

Comments

@sumitsg004
Copy link

sumitsg004 commented Jan 25, 2024

Hi Team,

I am trying to create a contract pact at consumer end for a provider which returns ZIP file in response.

Currently response expectations in my pact method look like below.

.willRespondWith()
.status(HttpStatus.OK.code)
.headers(mapOf(HttpHeaders.CONTENT_TYPE to zipContent))

Is there way to set expectation for contents of zip file? For example, if I want set expectation that inside zip file there should be specific directory/filename is present. Not bothered about file contents, but if a file or directory is present or not inside the zip file.
Is there a way to set such expectations under pact contract?

Note - Reason I want this type of validation is my service is not directly consuming zip file, but its more interested in files inside zip file. I want to set some expectation like a specific directory or filename is present inside zip file.

I tried posting this message in multiple slack groups, but unfortunately didn't get much response. Any suggestions on how to handle such cases would be really helpful.

@rholshausen rholshausen added the enhancement Indicates new feature requests label Jan 28, 2024
@rholshausen
Copy link
Contributor

There is nothing that can do that. The current implementation only supports checking that the body is a valid zip file.

This functionality could be implemented as a plugin.

@sumitsg004
Copy link
Author

@rholshausen , thank you for responding. How can we validate if body is valid zip file? Can you please provide any document or example for validating if its zip file. Or validating content-type header will suffice ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates new feature requests
Projects
None yet
Development

No branches or pull requests

2 participants