17:04:51.464 [error] #PID<0.488.0> running MyWeb.Router (connection #PID<0.487.0>, stream id 1) terminated
Server: localhost:4000 (http)
Request: GET /ping
** (exit) an exception was raised:
** (RuntimeError) expected dispatch/2 to return a Plug.Conn, all plugs must receive a connection (conn) and return a connection
My Endpoint:
defmodule MyWeb.Endpoint do
use Plug.Builder
Plug.Head
plug Corsica,
max_age: 600,
origins: "*",
allow_headers: ["accept", "content-type", "authorization"],
allow_methods: ["GET", "POST"],
allow_credentials: true,
log: [rejected: :error, invalid: :warn, accepted: :debug]
end
My Router:
defmodule MyWeb.Router do
use Plug.Router
require Ecto.Query
plug(:match)
plug(:dispatch)
plug(MyWeb.Endpoint)
get "/" do
send_resp(conn, 200, "hi there")
end
end
right I was using the wrong url, but the connection of plug is still an issue
Server: localhost:4000 (http)
Request: GET /ping
** (exit) an exception was raised:
** (RuntimeError) expected dispatch/2 to return a Plug.Conn, all plugs must receive a connection (conn) and return a connection