pact-jvm icon indicating copy to clipboard operation
pact-jvm copied to clipboard

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

Open sumitsg004 opened this issue 5 months ago • 3 comments

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.

sumitsg004 avatar Jan 25 '24 13:01 sumitsg004