     end
   end
 
-  def compress_body(body, "gzip"),    do: :zlib.gzip(body)
-  def compress_body(body, "deflate"), do: :zlib.zip(body)
+  defp compress_body(body, "gzip"),    do: :zlib.gzip(body)
+  defp compress_body(body, "deflate"), do: :zlib.zip(body)
 
+  @doc """
+  Decompress response, used by `Tesla.Middleware.DecompressResponse`
+  """
   def decompress(env) do
     env
     |> Map.update!(:body, &decompress_body(&1, env.headers["content-encoding"]))
   end
 
-  def decompress_body(<<31, 139, 8, _ :: binary>> = body, "gzip"), do: :zlib.gunzip(body)
-  def decompress_body(body, "deflate"),                            do: :zlib.unzip(body)
-  def decompress_body(body, _content_encoding),                    do: body
+  defp decompress_body(<<31, 139, 8, _ :: binary>> = body, "gzip"), do: :zlib.gunzip(body)
+  defp decompress_body(body, "deflate"),                            do: :zlib.unzip(body)
+  defp decompress_body(body, _content_encoding),                    do: body
 end
 
 defmodule Tesla.Middleware.CompressRequest do
+  @behaviour Tesla.Middleware
+
+  @moduledoc """
+  Only compress request.
+
+  See `Tesla.Middleware.Compression` for options.
+  """
+
   def call(env, next, opts) do
     env
     |> Tesla.Middleware.Compression.compress(opts)

defmodule Tesla.Middleware.Compression do
  def call(env, next, opts) do
    env
    |> compress(opts)

end

defmodule Tesla.Middleware.DecompressResponse do
  @behaviour Tesla.Middleware

  @moduledoc """
  Only decompress response.

  See `Tesla.Middleware.Compression` for options.
  """

  def call(env, next, _opts) do
    env
    |> Tesla.run(next)
