We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
def get_chunked(credentials, resource, action, params \\ nil) do %HTTPoison.AsyncResponse{id: ref} = HTTPoison.get!( url_factory(credentials, resource, action, params), [], recv_timeout: :infinity, stream_to: self() ) Stream.resource( fn -> "" end, fn previus_chunk_remanent -> receive do %HTTPoison.AsyncChunk{chunk: chunk, id: ^ref} -> capture = Regex.named_captures(~r/\[?(?<complete>.*})?(?<incomplete>.*)\]?/, chunk) partial_content = previus_chunk_remanent <> capture["complete"] next = extract_maps_if_any(partial_content) {next, create_chunk_remanent(next, partial_content, capture["incomplete"])} %HTTPoison.AsyncEnd{id: ^ref} -> {:halt, ""} end end, fn _ -> nil end ) |> Stream.map(&try_decode/1) end
Create an intermediary function that acts as buffer HTTP will stream to buffer and buffer will pass item by item on demand to Stream resource..
This should support Enum.take
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Create an intermediary function that acts as buffer
HTTP will stream to buffer and buffer will pass item by item on demand to Stream resource..
This should support Enum.take
The text was updated successfully, but these errors were encountered: