Skip to content

Commit

Permalink
wm_timeseries: simplify batch put data extraction from json
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei Zavada committed Mar 2, 2016
1 parent c6c0b5e commit fe3c070
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/riak_kv_wm_timeseries.erl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ validate_request(RD, Ctx) ->
-spec validate_request_v1(#wm_reqdata{}, #ctx{}) ->
?CB_RV_SPEC.
validate_request_v1(RD, Ctx = #ctx{method = 'POST'}) ->
Json = extract_json(RD),
Json = binary_to_list(wrq:req_body(RD)),
case extract_data(Json) of
Data when Data /= undefined ->
valid_params(
Expand Down Expand Up @@ -228,14 +228,6 @@ validate_request_v1(RD, Ctx = #ctx{method = 'DELETE', table = Table,
handle_error(Reason, RD, Ctx)
end.

extract_json(RD) ->
case proplists:get_value("json", RD#wm_reqdata.req_qs) of
undefined ->
%% if it was a PUT or POST, data is in body
binary_to_list(wrq:req_body(RD));
BodyInPost ->
BodyInPost
end.

%% because, techically, key and data are 'arguments', we check they
%% are well-formed, too.
Expand Down

0 comments on commit fe3c070

Please sign in to comment.