Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

Commit

Permalink
Fix invalid query response format
Browse files Browse the repository at this point in the history
Fix introspection by using the standard query response format ("data" instead of "d" and "errors" instead of "e").
  • Loading branch information
romshark committed May 23, 2019
1 parent 41b2599 commit 0f72e06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/transport/http/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ func (c *Client) QueryVar(
responseDecoderJSON := json.NewDecoder(resp.Body)

res := struct {
Data interface{} `json:"d"`
Error *graphResponseError `json:"e"`
Data interface{} `json:"data"`
Error *graphResponseError `json:"errors"`
}{
Data: result,
}
Expand Down
6 changes: 3 additions & 3 deletions api/transport/http/handleGraphQuery.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/romshark/dgraph_graphql_go/api/graph"
)

var graphRespHead = []byte(`{"d":`)
var graphRespHead = []byte(`{"data":`)
var graphRespTail = []byte(`}`)

type graphResponseError struct {
Expand All @@ -17,8 +17,8 @@ type graphResponseError struct {
}

type graphResponse struct {
Data []byte `json:"d"`
Error *graphResponseError `json:"e"`
Data []byte `json:"data"`
Error *graphResponseError `json:"errors"`
}

// graphQuery represents the JSON graph query structure
Expand Down

0 comments on commit 0f72e06

Please sign in to comment.