defmodule Distr do def init(_type, req, []) do {:ok, req, :no_state} end def terminate(reason, request, state) do :ok end def handle(req, state) do {url, _} = :cowboy_req.url(req) {code, body, headers} = case HTTPoison.request (:get, next_url(url)) do {:ok, resp} -> {resp.status_code, resp.body, resp.headers} {:error, _} -> {500, "