     end
   end
 
-  def decodable?(env, opts), do: decodable_body?(env) && decodable_content_type?(env, opts)
+  defp decodable?(env, opts), do: decodable_body?(env) && decodable_content_type?(env, opts)
 
-  def decodable_body?(env) do
+  defp decodable_body?(env) do
     (is_binary(env.body)  && env.body != "") ||
     (is_list(env.body)    && env.body != [])
   end
 
-  def decodable_content_type?(env, opts) do
+  defp decodable_content_type?(env, opts) do
     case env.headers["content-type"] do
       nil           -> false
       content_type  -> Enum.any?(content_types(opts), &String.starts_with?(content_type, &1))
     end
   end
 
-  def content_types(opts), do: @default_content_types ++ Keyword.get(opts, :decode_content_types, [])
+  defp content_types(opts), do: @default_content_types ++ Keyword.get(opts, :decode_content_types, [])
 
   defp process(data, op, opts) do
     with {:ok, value} <- do_process(data, op, opts) do

defmodule Tesla.Middleware.JSON do
  # NOTE: text/javascript added to support Facebook Graph API.
  #       see https://github.com/teamon/tesla/pull/13
  @default_content_types ["application/json", "text/javascript"]
  @default_engine Poison

  @doc """
  Encode and decode response body as JSON

  Available options:
  - `:decode` - decoding function
  - `:encode` - encoding function
  - `:engine` - encode/decode engine, e.g `Poison` or `JSX`  (defaults to Poison)
  - `:engine_opts` - optional engine options
  - `:decode_content_types` - list of additional decodable content-types
  """
  def call(env, next, opts) do
    opts = opts || []


    |> decode(opts)
  end

  @doc """
  Encode request body as JSON. Used by `Tesla.Middleware.EncodeJson`
  """
  def encode(env, opts) do
    if encodable?(env) do
      env
