I am a new user of the Phoenix Framework, and I am trying to configure a simple HTTP POST service that calculates the input data and returns the result, but I get the following error:
** (RuntimeError) expected connection to have a response but no response was set/sent stacktrace: (phoenix) lib/phoenix/conn_test.ex:311: Phoenix.ConnTest.response/2 (phoenix) lib/phoenix/conn_test.ex:366: Phoenix.ConnTest.json_response/2 test/controllers/translation_controller_test.exs:20
My test case:
test "simple POST" do post conn(), "/api/v1/foo", %{"request" => "bar"} IO.inspect body = json_response(conn, 200) end
My router definition:
scope "/api", MyWeb do pipe_through :api post "/v1/foo", TranslationController, :transform end
My controller:
def transform(conn, params) do doc = Map.get(params, "request") json conn, %{"response" => "grill"} end
What am I missing?
elixir phoenix-framework
stoft
source share