anchor.diff:        next(Req2, State2, fun request_id/2)
     end.
   
  -request_id(Req, State=#state{req_headers=ReqHeaders}) ->
  +request_id(Req, State=#state{req_headers=ReqHeaders, res_headers=ResHeaders}) ->
     case call(Req, State, request_id) of
       no_call ->
         next(Req, State, fun req_headers/2);
       {ID, Req2, HandlerState} ->
  -      Req3 = cowboy_req:set_resp_header(<<"x-request-id">>, ID, Req2),
  -      State2 = State#state{handler_state=HandlerState,
  -                           req_headers=[{<<"x-request-id">>, ID}|ReqHeaders]},
  -      next(Req3, State2, fun req_headers/2)
  +      State2 = State#state{handler_state=HandlerState,
  +                           req_headers=[{<<"x-request-id">>, ID}|ReqHeaders],
  +                           res_headers=[{<<"x-request-id">>, ID}|ResHeaders]},
  +      next(Req2, State2, fun req_headers/2)
     end.
   
   req_headers(Req, State=#state{req_headers=ReqHeaders}) ->
  
positive.code:   % after Timeout
    end.
  
  get_res_body(Req, State = #state{conn = Conn}) ->
    inet:setopts(Conn, [{active, once}, {packet, raw}]),
    receive
      {tcp, Conn, Data} ->
        ok = cowboy_req:chunk(Data, Req),
        get_res_body(Req, State);
      {tcp_closed, Conn} ->
        terminate(Req, State);
      Other ->
        io:format("~p~n", [Other]),
        get_res_body(Req, State)
    %% TODO add a response timeout
    % after Timeout
    end.
  
  
  
  % internal
  
  
negative.code:   end.
  
  init_request(Req, State=#state{method=Method}) ->
    {Version, Req2} = cowboy_req:version(Req),
    {Message, Req4} = case cowboy_req:path_info(Req2) of
      {<<"/", _>> = P, Req3} ->
        {format_request(Method, P, Version), Req3};
      {undefined, Req3} ->
        {format_request(Method, <<"/">>, Version), Req3};
      {Path, Req3} ->
        {format_request(Method, [<<"/">>, Path], Version), Req3}
    end,
    send(Req4, State, Message, fun forwarded_header_prefix/2).
  
  forwarded_header_prefix(Req, State=#state{backend=Backend, req_headers=ReqHeaders}) ->
    case call(Req, State, forwarded_header_prefix) of
  