examples/consumer/goconsumer/client.go
func (c *Client) getUser(id string) (*ex.User, error) {

	u := fmt.Sprintf("%s/users/%s", c.Host, id)
	req, err := http.NewRequest("GET", u, nil)

	// 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
	// will get a mismatch during Verification.
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", c.token)

	res, err := http.DefaultClient.Do(req)

	if res.StatusCode != 200 || err != nil {
		return nil, fmt.Errorf("get user failed")
	}

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, err
	}

	var response ex.User
	err = json.Unmarshal(data, &response)
	if err != nil {
		return nil, err
	}

	return &response, err
}
func (c *Client) getUser(id string) (*ex.User, error) {

	u := fmt.Sprintf("%s/users/%s", c.Host, id)
	req, err := http.NewRequest("GET", u, nil)

	// 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
	// will get a mismatch during Verification.
	req.Header.Set("Content-Type", "application/json")
	req.Header.Set("Authorization", c.token)

	res, err := http.DefaultClient.Do(req)

	if res.StatusCode != 200 || err != nil {
		return nil, fmt.Errorf("get user failed")
	}

	data, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return nil, err
	}

	var response ex.User
	err = json.Unmarshal(data, &response)
	if err != nil {
		return nil, err
	}

	return &response, err
}
// getUser finds a user