diff options
author | Péter Szilágyi <peterke@gmail.com> | 2019-09-10 17:20:36 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2019-09-10 17:20:36 +0800 |
commit | 49b86a28590917eebf43bce213a2e0586db58755 (patch) | |
tree | c308de92032c42daca438e5b0632b69f5a93ae65 | |
parent | cea2c804450fa1a6ff36b6a883085d60bf906de6 (diff) | |
download | go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.tar go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.tar.gz go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.tar.bz2 go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.tar.lz go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.tar.xz go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.tar.zst go-tangerine-49b86a28590917eebf43bce213a2e0586db58755.zip |
common, graphql: fix hash/address decoding + UI content type
-rw-r--r-- | common/types.go | 4 | ||||
-rw-r--r-- | graphql/graphiql.go | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/common/types.go b/common/types.go index 5cba4e9f3..8ca51a05f 100644 --- a/common/types.go +++ b/common/types.go @@ -149,7 +149,7 @@ func (h *Hash) UnmarshalGraphQL(input interface{}) error { var err error switch input := input.(type) { case string: - *h = HexToHash(input) + err = h.UnmarshalText([]byte(input)) default: err = fmt.Errorf("Unexpected type for Bytes32: %v", input) } @@ -288,7 +288,7 @@ func (a *Address) UnmarshalGraphQL(input interface{}) error { var err error switch input := input.(type) { case string: - *a = HexToAddress(input) + err = a.UnmarshalText([]byte(input)) default: err = fmt.Errorf("Unexpected type for Address: %v", input) } diff --git a/graphql/graphiql.go b/graphql/graphiql.go index 483d4cea3..864ebf57d 100644 --- a/graphql/graphiql.go +++ b/graphql/graphiql.go @@ -52,7 +52,7 @@ func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request) { respond(w, errorJSON("only GET requests are supported"), http.StatusMethodNotAllowed) return } - + w.Header().Set("Content-Type", "text/html") w.Write(graphiql) } |