thunder icon indicating copy to clipboard operation
thunder copied to clipboard

graphql.HTTPHandler leaks unwanted fields

Open fungl164 opened this issue 6 years ago • 1 comments

When using Pagination, the graphql.HTTPHandler() leaks an additional "__key: ..." field on the resulting edges which is not wanted.

Current quickfix: use diff.StripKey(value) on the resulting value...

func (h *httpHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	writeResponse := func(value interface{}, err error) {
		response := httpResponse{}
		if err != nil {
			response.Errors = []string{err.Error()}
		} else {
			response.Data = diff.StripKey(value)
		}

      ...

Not sure if this is the best solution, but for the moment it suffices.

Any help on a permanent fix would be greatly appreciated.

Many thanks for putting together this package.

Cheers

fungl164 avatar Dec 30 '18 06:12 fungl164

cc/ @berfarah

stephen avatar Jan 03 '19 17:01 stephen