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


  def call(%Conn{method: m} = conn, schema) when m in ["GET", "POST"] do
    if graphql?(conn) do
      case read_body(conn) do
        {:error, reason} -> handle_error(conn, reason)
        {:ok, query} ->
          cond do

    {"content-type", "application/graphql"} in conn.req_headers
  end

  defp read_whole_body(conn) do
    read_whole_body(read_body(conn), "")
  end

  defp read_whole_body({:ok, body, _conn}, acc), do: {:ok, acc <> body}
  defp read_whole_body({:more, partial_body, conn}, acc) do
    read_whole_body(read_body(conn), acc <> partial_body)
  end
  defp read_whole_body({:error, reason}, _acc), do: {:error, reason}
end
