anchor.diff:          RequestCache = #request_cache{request = Req} = cowboy_request_server:get(ReqKey),
           {RequestCache, Req}
       catch E:T ->
  -        error_logger:info_msg("~p:~p~n~p", [E, T, erlang:get_stacktrace()])
  +        error_logger:info_msg("~p:~p~n~p", [E, T, undefined])
       end.
   
   put_key(ReqKey, NewRequestCache) ->
  
positive.code:     case Res#response.data of
          {data, Body} ->
              % Assemble headers...
              Headers2 = simple_bridge_util:ensure_header(Headers,"Content-Type","text/html"),
  
              % Send the cowboy cookies
              {ok, FinReq} = send(Code, Headers2, Res#response.cookies, Body, Req),
              cowboy_request_server:set(ReqKey, RequestCache#request_cache{request = FinReq}),
              {ok, FinReq};
  
  
negative.code:     Req1 = prepare_cookies(Req, Cookies),
      Req2 = prepare_headers(Req1, Headers),
      Req3 = case Body of
  	       {sendfile, _, _Size, _FullPath} -> %%{stream, _Size, Fun} -> 
  		   cowboy_req:set_resp_body(Body, Req2);
  	       {stream, Fun} ->
  		   cowboy_req:set_resp_body(Fun, Req2);
  	       {chunked, Fun} ->
  		   cowboy_req:set_resp_body(Fun, Req2);
  	       _ ->
  		   cowboy_req:set_resp_body(Body, Req2)
  	   end,
      cowboy_req:reply(Code, Req3).
  
  
  prepare_cookies(Req, Cookies) ->
      lists:foldl(fun(C, R) ->
  			%% In case cookie name or value was set to an atom, we need to make
  			%% sure it's something usable, so let's just use binary
  			Name = simple_bridge_util:to_binary(C#cookie.name),
  			Value = simple_bridge_util:to_binary(C#cookie.value),
  			Options = #{
  			  domain => C#cookie.domain,
  			  path => C#cookie.path,
  			  max_age => C#cookie.max_age,
  			  secure => C#cookie.secure,
  			  http_only => C#cookie.http_only
  			 },
  			%% cowlib 1.0.0 (which is the dependency for cowboy 1.0.4) has a bug
  			%% that freaks out with {secure, false} or {http_only, false} so this
  			%% is a workaround.
  			%FilteredOptions = filter_cookie_options(Options),
  
  			Pred = fun(K,V) ->
  				       case K of
  					   secure when V  =/= true -> false;
  					   http_only when V =/= true -> false;
  					   _ when V==undefined -> false;
  					   _ -> true
  				       end
  			       end,
  			FilteredOptions = maps:filter(Pred,Options),
  			cowboy_req:set_resp_cookie(Name, Value, R, FilteredOptions)
  		end, Req, Cookies).
  
  %% filter_cookie_options([]) ->
  %%     [];
  %% filter_cookie_options([{secure, Any} | Opts]) when Any =/= true ->
  %%     filter_cookie_options(Opts);
  %% filter_cookie_options([{http_only, Any} | Opts]) when Any =/= true ->
  %%     filter_cookie_options(Opts);
  %% filter_cookie_options([{_, undefined} | Opts]) ->
  %%     filter_cookie_options(Opts);
  %% filter_cookie_options([Opt | Opts]) ->
  %%     [Opt | filter_cookie_options(Opts)].
  
  prepare_headers(Req, Headers) ->
      lists:foldl(fun({Header, Value}, R) -> cowboy_req:set_resp_header(Header, Value, R) end, Req, Headers).
  