anchor.diff:      {done, Req2} ->
         ok = gun:data(Conn, Ref, fin, <<>>),
         next(Req2, State, fun res_status/2);
  -    {error, _Reason} ->
  -      %% TODO send back a better error message
  -      next(Req, State, 400)
  -  end.
  -
  -res_status(Req, State = #state{conn = Conn, ref = Ref, timeout = _Timeout, res_headers = ResHeaders}) ->
  -  receive
  -    {gun_response, Conn, Ref, Fin, Status, Headers} ->
  +    {error, Reason} ->
  +      error_terminate(Req, State, error, Reason, chunk_req_body, 2, 400)
  +  end.
  +
  +res_status(Req, State = #state{conn = Conn, ref = Ref, timeout = Timeout, res_headers = ResHeaders}) ->
  +  case gun:await(Conn, Ref, Timeout) of
  +    {response, Fin, Status, Headers} ->
         next(Req, State#state{res_status = Status,
                               res_headers = filter_headers(Headers, ResHeaders),
  -                            res_has_body = Fin =:= nofin}, fun res_headers/2)
  -  %% after Timeout TODO
  +                            res_has_body = Fin =:= nofin}, fun res_headers/2);
  +    {error, timeout} ->
  +      next(Req, State, 504);
  +    {error, Reason} ->
  +      error_terminate(Req, State, error, Reason, res_status, 2, 502)
     end.
   
   res_headers(Req, State = #state{res_headers = ResHeaders}) ->
  
positive.code:   Ref = gun:request(Conn, Method, Path, Headers),
    next(Req, State#state{ref = Ref}, fun req_body/2).
  
  req_body(Req, State = #state{conn = Conn, ref = Ref}) ->
    case cowboy_req:has_body(Req) of
      true ->
        case exported(Req, State, req_body, 3) of
  
negative.code:         _ ->
            next(Req, State, fun chunk_req_body/2)
        end;
      _ when Method =:= <<"POST">> orelse Method =:= <<"PUT">> orelse Method =:= <<"PATCH">> ->
        ok = gun:data(Conn, Ref, fin, []),
        next(Req, State, fun res_status/2);
      _ ->
        next(Req, State, fun res_status/2)
    end.
  
  