Closed kelvinji2009 closed 6 years ago
Hi,
req := graphql.NewRequest(` query { getAccessTokenByAppSecret( clientId: $clientID, secret: $appSecret ) } `) req.Var("clientID", clientID) req.Var("appSecret", appSecret) ctx := context.Background() var responseData map[string]interface{} if err := c.userGraphqlClient.Run(ctx, req, &responseData); err != nil { log.Fatal(err) }
☆ examples »go run main.go 2018/03/18 01:52:04 >> variables: {"appSecret":"5cf63e2b82f2d6b41bdcfec8b483b740","clientID":"5a48b6ae863b3b0001893bbc"} 2018/03/18 01:52:04 >> files: 0 2018/03/18 01:52:04 >> query: query { getAccessTokenByAppSecret( clientId: $clientID, secret: $appSecret ) } 2018/03/18 01:52:04 >> headers: map[Content-Type:[multipart/form-data; boundary=f262269d26f9acbc6a727ad9e0becd29acbc33c1f0110691763f4cb54862] Accept:[application/json]] 2018/03/18 01:52:05 << POST body missing. Did you forget use body-parser middleware? 2018/03/18 01:52:05 decoding response: invalid character 'P' looking for beginning of value exit status 1
Please update and try again following https://github.com/machinebox/graphql/pull/15.
@matryer Great. It works now. Thanks a lot.
Hi,
Sample code(Using default http client)
Log info