GitHub
07/27/2023, 8:38 AMMock server failed with the following mismatches:
0) The following request was incorrect:
PUT /picking-capacity/capacities/1
'Content-Type': Expected value 'application/json' at index 1 but was missing
Steps to reproduce
import { PactV3 } from "@pact-foundation/pact";
import axios from "axios";
import path from "path";
const provider = new PactV3({
port: 8082,
dir: path.resolve(process.cwd(), "pacts"),
cors: true,
pactfileWriteMode: "update",
consumer: "application",
provider: "applicationApi",
logLevel: "debug",
});
describe("serviceUnderTest", () => {
it("should validate PUT request", async () => {
await provider.addInteraction({
states: [{ description: "resource exists" }],
uponReceiving: "update",
withRequest: {
method: "PUT",
path: "/resource/1",
headers: {
"Content-Type": "application/json",
},
body: {},
},
willRespondWith: {
status: 200,
headers: {
"Content-Type": "application/json",
},
body: {},
},
});
await provider.executeTest(async () => {
await axios.put("<http://localhost:8082/resource/1>", {});
});
});
})
Relevant log files
pact-debug.log
pact-foundation/pact-js