Skip to content

Commit 4f6bf2f

Browse files
authored
Merge pull request #20046 from karalabe/graphql-fix-web-and-decoding
common, graphql: fix hash/address decoding + UI content type
2 parents cea2c80 + 49b86a2 commit 4f6bf2f

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

common/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ func (h *Hash) UnmarshalGraphQL(input interface{}) error {
149149
var err error
150150
switch input := input.(type) {
151151
case string:
152-
*h = HexToHash(input)
152+
err = h.UnmarshalText([]byte(input))
153153
default:
154154
err = fmt.Errorf("Unexpected type for Bytes32: %v", input)
155155
}
@@ -288,7 +288,7 @@ func (a *Address) UnmarshalGraphQL(input interface{}) error {
288288
var err error
289289
switch input := input.(type) {
290290
case string:
291-
*a = HexToAddress(input)
291+
err = a.UnmarshalText([]byte(input))
292292
default:
293293
err = fmt.Errorf("Unexpected type for Address: %v", input)
294294
}

graphql/graphiql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request) {
5252
respond(w, errorJSON("only GET requests are supported"), http.StatusMethodNotAllowed)
5353
return
5454
}
55-
55+
w.Header().Set("Content-Type", "text/html")
5656
w.Write(graphiql)
5757
}
5858

0 commit comments

Comments
 (0)