wire up example by way of testing

This commit is contained in:
Ben Kraft
2019-12-24 16:05:10 -05:00
parent 9a157470b3
commit 9d4b5559f4
5 changed files with 41 additions and 6 deletions
+5
View File
@@ -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"`