         end
     end
   end
+
+  defp graphql?(conn) do
+    {"content-type", "application/graphql"} in conn.req_headers
+  end
+
+  defp read_body(conn) do
+    read_body(Plug.Conn.read_body(conn), "")
+  end
+
+  defp read_body({:ok, body, _conn}, acc), do: {:ok, acc <> body}
+  defp read_body({:more, partial_body, conn}, acc) do
+    read_body(Plug.Conn.read_body(conn), acc <> partial_body)
+  end
+  defp read_body({:err, reason}, _acc), do: {:err, reason}
 end

    end
  end

  def call(%Conn{method: m} = conn, _) when m in ["GET", "POST"] do
    handle_error(conn, "Must provide query string.")
  end

  def call(%Conn{method: _} = conn, _) do

defmodule GraphQL.Plug.Endpoint do
  import Plug.Conn, except: [read_body: 1, read_body: 2]
  alias Plug.Conn

  @behaviour Plug
