title: How to test controller methods that use HEAD in Phoenix
body: <p>Currently the documentation is clear and vibrant with the common <code>HTTP</code> verbs, but we started implementing some <code>HEAD</code> routes today and it is not tested the same way as the others.</p>
  
  <p>To test say a <code>GET</code> method:</p>
  
  <p><code>conn = get conn, controller_path(conn, :controller_method, params)
  </code></p>
  
  <p>So I would assume you would just change <code>get</code> to <code>head</code>, but this is not the case.</p>
  
  <p>Here is my route:</p>
  
  <p><code>template_journeys_count_path  HEAD    /v1/templates/:template_id/journeys        GondorWeb.V1.JourneyController :count</code></p>
  
  <p>and my controller method:</p>
  
  <p><code>def count(conn, %{"template_id" =&gt; template_id}) do
      count = Templates.get_journey_count(template_id)
      conn
      |&gt; put_resp_header("x-total-count", count)
      |&gt; send_resp(204, "")
   end</code></p>
  
  <p>and my test:</p>
  
  <p><code>conn = head conn, template_journeys_count_path(conn, :count, template.id)
  assert response(conn, 204)</code></p>
  
  <p>But I am getting an error saying no response received and the <code>resp_header</code> that I added what not in <code>conn.resp_headers</code></p>
  
  <p>Am I missing something? I also tried to set up a connection build using <code>Plug.ConnTest</code>'s method <code>build_conn</code> passing the <code>HEAD</code> method into it but still no luck.</p>