Hi Folks, we are writing pact consumer test for me...
# pact-go
s
Hi Folks, we are writing pact consumer test for message. Trying to pass in headers using WithMetadata but its failing. Could someone please help ?
Copy code
err := p.AddAsynchronousMessage().
		Given("Event is received").
		ExpectsToReceive("Event").
		UsingPlugin(message.PluginConfig{
			Plugin:  "protobuf",
			Version: "0.3.4",
		}).
		WithContents(protoMessage, "application/protobuf").
		WithMetadata(headers).
		ExecuteTest(t, func(m message.AsynchronousMessage) error {
			return nil
		})

p.AddAsynchronousMessage().Given("Event is received").ExpectsToReceive("Evenr").UsingPlugin((message.PluginConfig literal)).WithContents(protoMessage, "application/protobuf").WithMetadata undefined (type *v4.AsynchronousMessageWithPluginContents has no field or method WithMetadata)
m
It's available, but you need to configure it earlier in the builder
s
Oh gotcha, cool thanks @Matt (pactflow.io / pact-js / pact-go) will try this out
👍 1
I have added metadata info as you mentioned. But metadata is missing in the contract. To make sure, i tested out with the eg provided here which also fails to record metadata. Please find the bug i created for your ref: https://github.com/pact-foundation/pact-go/issues/331