From 467dea56d27e154363e1975f6e9f4dbf66148e79 Mon Sep 17 00:00:00 2001 From: Brendan Devenney Date: Mon, 1 Apr 2019 20:37:33 +0100 Subject: [PATCH] fix(docs): Fix code examples, update E2E test steps (#110) fix(docs): fix code examples, update E2E test steps --- CONTRIBUTING.md | 2 +- README.md | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c8ea91267..8baf15e1e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ Please provide the following information with your issue to enable us to respond You can run the E2E tests by: ```sh -make package # Assemble the latest Pact Go from Ruby and compile Go +make tools # Assemble the latest Pact Go from Ruby and compile Go make pact # Run the Pact tests - consumer + provider ``` diff --git a/README.md b/README.md index a3394f6ca..3622ec63b 100644 --- a/README.md +++ b/README.md @@ -167,7 +167,10 @@ func TestConsumer(t *testing.T) { // Pass in test case. This is the component that makes the external HTTP call var test = func() (err error) { u := fmt.Sprintf("http://localhost:%d/foobar", pact.Server.Port) - req, _ := http.NewRequest("GET", u, strings.NewReader(`{"name":"billy"}`)) + req, err := http.NewRequest("GET", u, strings.NewReader(`{"name":"billy"}`)) + if err != nil { + return err + } // NOTE: by default, request bodies are expected to be sent with a Content-Type // of application/json. If you don't explicitly set the content-type, you @@ -175,8 +178,9 @@ func TestConsumer(t *testing.T) { req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer 1234") - _, err = http.DefaultClient.Do(req); err != nil { - return + if _, err = http.DefaultClient.Do(req); err != nil { + return err + } } // Set up our expected interactions.