mirror of
https://github.com/edgurgel/httparrot
synced 2025-04-05 16:22:32 -04:00
Fix warnings (#21)
This commit is contained in:
parent
9fd674667a
commit
d604cd8863
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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 ->
|
||||||
|
|
Loading…
Add table
Reference in a new issue