anchor.diff:               fun() -> stream_buckets(ReqId) end};
           {ReqId, timeout} -> {mochijson2:encode({struct, [{error, timeout}]}), done}
       end.
  +
  
positive.code:             {true, RD, Ctx};
          false ->
              Res = riak_core_security:check_permission({"riak_kv.list_buckets",
                                                         <<"default">>},
                                                        Ctx#ctx.security),
              case Res of
                  {false, Error, _} ->
  
negative.code:     case wrq:get_qs_value(?Q_BUCKETS, RD) of
          ?Q_TRUE ->
              %% Get the buckets.
              {ok, Buckets} = Client:list_buckets(none, Timeout, BType),
              {mochijson2:encode({struct, [{?JSON_BUCKETS, Buckets}]}), 
               RD, Ctx};
          ?Q_STREAM ->
              F = fun() ->
                          {ok, ReqId} = Client:stream_list_buckets(none, Timeout, BType),
                          stream_buckets(ReqId)
                  end,
              {{stream, {[], F}}, RD, Ctx};
  