|
|
@ -17,8 +17,10 @@ |
|
|
|
package graphql |
|
|
|
package graphql |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
|
|
|
|
"context" |
|
|
|
"encoding/json" |
|
|
|
"encoding/json" |
|
|
|
"net/http" |
|
|
|
"net/http" |
|
|
|
|
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/eth/filters" |
|
|
|
"github.com/ethereum/go-ethereum/eth/filters" |
|
|
|
"github.com/ethereum/go-ethereum/internal/ethapi" |
|
|
|
"github.com/ethereum/go-ethereum/internal/ethapi" |
|
|
@ -41,7 +43,10 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
response := h.Schema.Exec(r.Context(), params.Query, params.OperationName, params.Variables) |
|
|
|
ctx, cancel := context.WithTimeout(r.Context(), 60*time.Second) |
|
|
|
|
|
|
|
defer cancel() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
response := h.Schema.Exec(ctx, params.Query, params.OperationName, params.Variables) |
|
|
|
responseJSON, err := json.Marshal(response) |
|
|
|
responseJSON, err := json.Marshal(response) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError) |
|
|
|
http.Error(w, err.Error(), http.StatusInternalServerError) |
|
|
|