   @doc """
   Send HTTP request with the given parameters.
 
-  `options` accepts any options available in `:hackney.request/5`.
-  Additionally, `:params` option can take query params as `Hipchat.Client.query_params_t`.
+  `options` accepts any options available in `:httpc.request/4`. Additionally,
+
+  - `:http_options` for `http_options` in `:httpc.request/4`
+  - `:params` option can take query params as `Hipchat.Client.query_params_t`.
   """
   @spec request(method_t, String.t, term, headers_t, options_t) :: res_t
   def request(method, url, body, headers, options \\ []) do
-    url1              = append_params(url, options)
-    options1          = [{:with_body, true} | options]
-    {body1, headers1} = serialize_body(body, headers)
-    request           = %{method: method, url: url1, headers: headers1, body: body1, options: options1}
-    case :hackney.request(method, url1, headers1, body1, options1) do
-      {:ok, status, resp_headers, resp_body} -> Response.new(status, convert_resp_headers(resp_headers), resp_body, request)
-      {:ok, status, resp_headers}            -> Response.new(status, convert_resp_headers(resp_headers), "", request)
-      # Won't use stream mode so its branch is omitted
-      error_tuple                            -> error_tuple
+    url1          = url_with_params(url, options)
+    {body1, type} = serialize_body(body)
+    httpc_req     = httpc_req(url1, headers, type, body1)
+    request_dump  = %{method: method, httpc_req: httpc_req}
+    case :httpc.request(method, httpc_req, Keyword.get(options, :http_options, []), force_sync_options(options)) do
+      {:ok, {{_http_ver, status, _reason}, resp_headers, resp_body}} ->
+        Response.new(status, charlist_kvs_to_map(resp_headers), resp_body, request_dump)
+      {:error, _} = error_tuple ->
+        error_tuple
     end
   end
 
-  defp append_params(url, options) do
+  defp url_with_params(url, options) do
     case options[:params] do
-      [_ | _] = params -> url <> "?" <> URI.encode_query(params)
-      _empty_or_nil    -> url
+      [_ | _] = params -> URI.encode(url) <> "?" <> URI.encode_query(params)
+      _empty_or_nil    -> URI.encode(url)
     end
   end
 
-  defp serialize_body("", headers) do
-    {"", headers}
+  defp serialize_body("") do
+    {nil, nil}
   end
-  defp serialize_body(body, headers) do
+  defp serialize_body(body) do
     case serializer() do
       Poison ->
-        {Poison.encode!(body), [{"content-type", "application/json"} | headers]}
+        {Poison.encode!(body), 'application/json'}
       :form ->
-        {URI.encode_query(body), [{"content-type", "application/x-www-form-urlencoded"} | headers]}
+        {URI.encode_query(body), 'application/x-www-form-urlencoded'}
     end
   end
 

    Application.get_env(:hipchat_elixir, :serializer, Poison)
  end

  defp convert_resp_headers(resp_headers) do
    Map.new(resp_headers, fn {key, value} ->
      {String.downcase(key), value}
    end)
  end
end

    end
  end

  @type method_t  :: :get | :post | :put | :delete
  @type headers_t :: [{String.t, String.t}]
  @type options_t :: list
