Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix warnings with elixir-1.4.0-rc.1 #201

Merged
merged 1 commit into from
Dec 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions lib/httpoison/base.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ defmodule HTTPoison.Base do

@endpoint "https://api.github.com"

defp process_url(url) do
def process_url(url) do
@endpoint <> url
end
end
Expand All @@ -33,37 +33,37 @@ defmodule HTTPoison.Base do
# Called in order to process the url passed to any request method before
# actually issuing the request.
@spec process_url(binary) :: binary
defp process_url(url)
def process_url(url)

# Called to arbitrarily process the request body before sending it with the
# request.
@spec process_request_body(term) :: binary
defp process_request_body(body)
def process_request_body(body)

# Called to arbitrarily process the request headers before sending them
# with the request.
@spec process_request_headers(term) :: [{binary, term}]
defp process_request_headers(headers)
def process_request_headers(headers)

# Called before returning the response body returned by a request to the
# caller.
@spec process_response_body(binary) :: term
defp process_response_body(body)
def process_response_body(body)

# Used when an async request is made; it's called on each chunk that gets
# streamed before returning it to the streaming destination.
@spec process_response_chunk(binary) :: term
defp process_response_chunk(chunk)
def process_response_chunk(chunk)

# Called to process the response headers before returning them to the
# caller.
@spec process_headers([{binary, term}]) :: term
defp process_headers(headers)
def process_headers(headers)

# Used to arbitrarily process the status code of a response before
# returning it to the caller.
@spec process_status_code(integer) :: term
defp process_status_code(status_code)
def process_status_code(status_code)

"""

Expand All @@ -81,24 +81,24 @@ defmodule HTTPoison.Base do
"""
def start, do: :application.ensure_all_started(:httpoison)

defp process_url(url) do
def process_url(url) do
HTTPoison.Base.default_process_url(url)
end

defp process_request_body(body), do: body
def process_request_body(body), do: body

defp process_response_body(body), do: body
def process_response_body(body), do: body

defp process_request_headers(headers) when is_map(headers) do
def process_request_headers(headers) when is_map(headers) do
Enum.into(headers, [])
end
defp process_request_headers(headers), do: headers
def process_request_headers(headers), do: headers

defp process_response_chunk(chunk), do: chunk
def process_response_chunk(chunk), do: chunk

defp process_headers(headers), do: headers
def process_headers(headers), do: headers

defp process_status_code(status_code), do: status_code
def process_status_code(status_code), do: status_code

@doc false
@spec transformer(pid) :: :ok
Expand Down
2 changes: 1 addition & 1 deletion test/httpoison_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ defmodule HTTPoisonTest do

assert_receive %HTTPoison.AsyncStatus{ id: ^id, code: 200 }, 100

refute_receive %HTTPoison.AsyncHeaders{ id: ^id, headers: headers }, 100
refute_receive %HTTPoison.AsyncHeaders{ id: ^id, headers: _headers }, 100
{:ok, ^resp} = HTTPoison.stream_next(resp)
assert_receive %HTTPoison.AsyncHeaders{ id: ^id, headers: headers }, 100

Expand Down