Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Throw bad request if the body is blank.

  • Loading branch information...
commit afea6fe4cc5810300068e0dd347bb4446f67dc88 1 parent 473cefa
@cmeiklejohn authored
Showing with 16 additions and 11 deletions.
  1. +16 −11 src/riak_kv_wm_pipelines.erl
View
27 src/riak_kv_wm_pipelines.erl
@@ -68,18 +68,23 @@ maybe_create_pipeline(ReqData, Context) ->
case Context#context.pipeline of
undefined ->
- RawPipeline = mochijson2:decode(Body),
- {struct, AtomPipeline} = atomize(RawPipeline),
- Name = atomized_get_value(name, AtomPipeline, undefined),
- Fittings = proplists:get_value(fittings, AtomPipeline),
- FittingSpecs = fittings_to_fitting_specs(Fittings),
-
- case register_pipeline(Name, FittingSpecs) of
- {ok, _} ->
- {true, Context#context{pipeline=Name}};
+ case Body of
+ <<"">> ->
+ {false, Context};
_ ->
- {false, Context}
- end;
+ RawPipeline = mochijson2:decode(Body),
+ {struct, AtomPipeline} = atomize(RawPipeline),
+ Name = atomized_get_value(name, AtomPipeline, undefined),
+ Fittings = proplists:get_value(fittings, AtomPipeline),
+ FittingSpecs = fittings_to_fitting_specs(Fittings),
+
+ case register_pipeline(Name, FittingSpecs) of
+ {ok, _} ->
+ {true, Context#context{pipeline=Name}};
+ _ ->
+ {false, Context}
+ end
+ end;
_Pipeline ->
{true, Context}
end.
Please sign in to comment.
Something went wrong with that request. Please try again.