wire up example by way of testing
This commit is contained in:
@@ -3,6 +3,7 @@ package {{.PackageName}}
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -35,6 +36,10 @@ func {{.OperationName}}(ctx context.Context) (*{{.ResponseName}}, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("returned error %v: %v", resp.Status, string(body))
|
||||
}
|
||||
|
||||
var retval struct {
|
||||
Data {{.ResponseName}} `json:"data"`
|
||||
Errors gqlerror.List `json:"errors"`
|
||||
|
||||
Reference in New Issue
Block a user