Skip to content

Commit

Permalink
update code style by credo's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwencool committed Dec 18, 2016
1 parent 71ddab0 commit a350acd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/maxwell/adapter/hackney.ex
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if Code.ensure_loaded?(:hackney) do
end

defp format_response({:ok, status, headers, body}, conn) when is_binary(body) do
headers = for {key, value}<- headers, into: %{} do
headers = for {key, value} <- headers, into: %{} do
down_key = key |> to_string |> String.downcase
{down_key, {key, to_string(value)}}
end
Expand Down
10 changes: 5 additions & 5 deletions lib/maxwell/adapter/ibrowse.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if Code.ensure_loaded?(:ibrowse) do
[`ibrowse`](https://github.com/cmullaparthi/ibrowse) adapter
"""

@chunk_size 4*1024*1024
@chunk_size 4 * 1024 * 1024
use Maxwell.Adapter


Expand Down Expand Up @@ -83,7 +83,7 @@ if Code.ensure_loaded?(:ibrowse) do

defp format_response({:ok, status, headers, body}, conn) do
{status, _} = status |> to_string |> Integer.parse
headers = for {key, value}<- headers, into: %{} do
headers = for {key, value} <- headers, into: %{} do
down_key = key |> to_string |> String.downcase
{down_key, {key, to_string(value)}}
end
Expand Down Expand Up @@ -124,14 +124,14 @@ if Code.ensure_loaded?(:ibrowse) do
end
defp stream_iterate(next_stream_fun)when is_function(next_stream_fun, 1) do
case next_stream_fun.({:cont, nil}) do
{:suspended, elem, next_stream_fun} -> {:ok, elem, next_stream_fun}
{:suspended, item, next_stream_fun} -> {:ok, item, next_stream_fun}
{:halted, _} -> :eof
{:done, _} -> :eof
end
end
defp stream_iterate(stream) do
case Enumerable.reduce(stream, {:cont, nil}, fn(elem, nil) -> {:suspend, elem} end) do
{:suspended, elem, next_stream} -> {:ok, elem, next_stream}
case Enumerable.reduce(stream, {:cont, nil}, fn(item, nil)-> {:suspend, item} end) do
{:suspended, item, next_stream} -> {:ok, item, next_stream}
{:done, _} -> :eof
{:halted, _} -> :eof
end
Expand Down
2 changes: 1 addition & 1 deletion lib/maxwell/middleware/header.ex
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ defmodule Maxwell.Middleware.Headers do

def init(headers) do
check_headers(headers)
Conn.put_req_header(%Conn{}, headers) |> Map.get(:req_headers)
%Conn{} |> Conn.put_req_header(headers) |> Map.get(:req_headers)
end

def request(conn, req_headers) do
Expand Down

0 comments on commit a350acd

Please sign in to comment.