Add GraphQL GET support for subgraph endpoints

オープン
#2,851 コメント 6 件 リアクション 6 件 担当者 1 名 GitHub で見る

@dotansimha がすでに取り組んでいます。

2022年1月4日 から。

評価

この issue はまだ評価されていません。

説明

area/graphql

Do you want to request a feature or report a bug?

I understanding it as bug, since GET requests should be supported by GraphQL compatible services.

https://graphql.org/learn/serving-over-http/#http-methods-headers-and-body

What is the current behavior?

Currently when accessing a subgraph URL using a GET request one gets redirected to /graphql (which is expected), however the /graphql handler does not work as expected.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Here is an example:

curl \
  --data '{"query":"query{signals(where:{id:\"0xb855e1847f49326ea13daeb454707faf4577604828827a780a81620000c4c2cf\"}){timestamp}}"}' \
  'https://api.thegraph.com/subgraphs/id/QmXe1SyxVqha6ipb8d3hht4WZaVzy43MUVXLoqXvYrb9dX'

Returns:

{"data":{"signals":[{"timestamp":"1632414153"}]}}

The same is expected to but is not returned by:

curl \
  'https://api.thegraph.com/subgraphs/id/QmXe1SyxVqha6ipb8d3hht4WZaVzy43MUVXLoqXvYrb9dX/graphql?query=query%7Bsignals(where:%7Bid:%220xb855e1847f49326ea13daeb454707faf4577604828827a780a81620000c4c2cf%22%7D)%7Btimestamp%7D%7D'

Here is a sample GraphQL URL that supports both modes:

POST

curl \
  -H "Content-Type: application/json" \
  --data '{"query":"{movies{name,genre}}"}' \
  'https://n7b67.sse.codesandbox.io/graphql'

GET

curl \
  'https://n7b67.sse.codesandbox.io/graphql?query=%7Bmovies%7Bname,genre%7D%7D'

What is the expected behavior?

GET requests should return the same results as POST requests. The difference is that the payload is passed in the URL's query string of the GET request, instead of the POST body.

主要言語
Rust
スター
3.2k
フォーク
1.1k
平均マージ
4日 1時間
マージ済み PR(30日)
1

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

graphprotocol/graph-node のほかの issue

graphprotocol/graph-node の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。