diff --git a/examples/v3/pacts/V3Consumer-V3Provider.json b/examples/v3/pacts/V3Consumer-V3Provider.json index 7c49c8735..98a2302d6 100644 --- a/examples/v3/pacts/V3Consumer-V3Provider.json +++ b/examples/v3/pacts/V3Consumer-V3Provider.json @@ -9,7 +9,7 @@ { "name": "User foo exists", "params": { - "id": "foo" + "some": "param" } } ], diff --git a/examples/v3/provider_test.go b/examples/v3/provider_test.go index 99539f9ff..8d1927205 100644 --- a/examples/v3/provider_test.go +++ b/examples/v3/provider_test.go @@ -57,7 +57,7 @@ func TestV3HTTPProvider(t *testing.T) { // ... do something // Optionally (if there are generators in the pact) return provider state values to be used in the verification (only ) - return v3.ProviderStateV3Response{"id": "bar"}, nil + return v3.ProviderStateV3Response{"uuid": "1234"}, nil // return nil, nil }, diff --git a/v3/http_verifier.go b/v3/http_verifier.go index f49e1c1a9..3af7561b7 100644 --- a/v3/http_verifier.go +++ b/v3/http_verifier.go @@ -220,6 +220,8 @@ func stateHandlerMiddleware(stateHandlers StateHandlers) proxy.Middleware { return } + // TODO: update rust code - params should be in a sub-property, to avoid top-level key conflicts + // i.e. it's possible action/state are actually something a users wants to supply delete(params, "action") delete(params, "state") state.Params = params @@ -242,7 +244,9 @@ func stateHandlerMiddleware(stateHandlers StateHandlers) proxy.Middleware { // Return provider state values for generator if res != nil { + log.Println("[TRACE] returning values from provider state (raw)", res) resBody, err := json.Marshal(res) + log.Println("[TRACE] returning values from provider state (JSON)", string(resBody)) if err != nil { log.Printf("[ERROR] state handler for '%v' errored: %v", state.State, err) @@ -251,6 +255,7 @@ func stateHandlerMiddleware(stateHandlers StateHandlers) proxy.Middleware { return } + w.Header().Add("content-type", "application/json") w.Write(resBody) } }