machinebox / graphql

Simple low-level GraphQL HTTP client for Go
https://blog.machinebox.io/a-graphql-client-library-for-go-5bffd0455878
Apache License 2.0
937 stars 218 forks source link

added header customizability to graphql.Request #10

Closed jsonkao closed 6 years ago

jsonkao commented 6 years ago

This PR gives developers the ability to add their own headers to a graphql.Request. The graphql.Request.Header mirrors the Header of a http.Request. It contains the request header fields sent by the client.

If a server received a request with header lines,

Host: example.com
accept-encoding: gzip, deflate
Accept-Language: en-us
fOO: Bar
foo: two

then


Header = map[string][]string{
  "Accept-Encoding": {"gzip, deflate"},
  "Accept-Language": {"en-us"},
  "Foo": {"Bar", "two"},
}
jsonkao commented 6 years ago

+1

matryer commented 6 years ago

@jkao1 Is there a reason why you didn't just use http.Header instead of making your own?