1
0
Fork 0
mirror of https://github.com/edgurgel/httparrot synced 2025-04-06 00:32:34 -04:00

fix warnings

This commit is contained in:
Po Chen 2016-09-09 10:24:05 +10:00
parent 9fd674667a
commit e8a108c9a4
2 changed files with 3 additions and 3 deletions

View file

@ -10,7 +10,7 @@ defmodule HTTParrot.CookiesHandler do
def get_json(req, state) do def get_json(req, state) do
{cookies, req} = :cowboy_req.cookies(req) {cookies, req} = :cowboy_req.cookies(req)
if cookies == [], do: cookies = [{}] cookies = if cookies == [], do: [{}], else: cookies
{response(cookies), req, state} {response(cookies), req, state}
end end

View file

@ -25,13 +25,13 @@ defmodule HTTParrot.StreamBytesHandler do
def get_bytes(req, state) do def get_bytes(req, state) do
{n, seed, chunk_size} = state {n, seed, chunk_size} = state
:random.seed(seed, seed, seed) :rand.seed(:exs64, {seed, seed, seed})
{{:chunked, stream_response(n, chunk_size)}, req, nil} {{:chunked, stream_response(n, chunk_size)}, req, nil}
end end
defp stream_response(n, chunk_size) do defp stream_response(n, chunk_size) do
fn(send_func) -> fn(send_func) ->
Stream.repeatedly(fn -> :random.uniform(255) end) Stream.repeatedly(fn -> :rand.uniform(255) end)
|> Stream.take(n) |> Stream.take(n)
|> Enum.chunk(chunk_size, chunk_size, []) |> Enum.chunk(chunk_size, chunk_size, [])
|> Enum.each(fn chunk -> |> Enum.each(fn chunk ->