use end_json to end streaming when in streaming mode in addition

to `end_stream`
This commit is contained in:
alisdair sullivan 2014-08-13 23:00:35 -07:00
parent b14714aef9
commit c25bb49902
5 changed files with 38 additions and 7 deletions

View file

@ -150,7 +150,7 @@ incomplete(State, Rest, Handler, Acc, Stack, Config = #config{stream=false}) ->
incomplete(State, Rest, Handler, Acc, Stack, Config = #config{incomplete_handler=false}) ->
{incomplete, fun(Stream) when is_binary(Stream) ->
resume(<<Rest/binary, Stream/binary>>, State, Handler, Acc, Stack, Config);
(end_stream) ->
(End) when End == end_stream; End == end_json ->
case resume(<<Rest/binary, ?space/utf8>>, State, Handler, Acc, Stack, Config#config{stream=false}) of
{incomplete, _} -> ?error(State, Rest, Handler, Acc, Stack, Config);
Else -> Else