Skip to content

Commit bab07c2

Browse files
committed
Merge pull request #12 from atesta/master
append data with POST request
2 parents 8470624 + 5fc74c3 commit bab07c2

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/luwak_wm_file.erl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,8 +521,12 @@ accept_doc_body(RD, Ctx=#ctx{key=K, client=C, file_props=FP}) ->
521521
HCtx = Ctx#ctx{handle={ok,H1}},
522522
{accept_streambody(RD, HCtx), RD, HCtx}.
523523

524-
accept_streambody(RD, #ctx{handle={ok, H}, client=C}) ->
525-
Stream = luwak_put_stream:start_link(C, H, 0, 1000),
524+
accept_streambody(RD, #ctx{handle={ok, H}, client=C, method=Method}) ->
525+
Offset = case Method of
526+
'POST' -> luwak_file:length(C,H);
527+
_ ->0
528+
end,
529+
Stream = luwak_put_stream:start_link(C, H, Offset, 1000),
526530
Size = luwak_file:get_default_block_size(),
527531
accept_streambody1(Stream, 0, wrq:stream_req_body(RD, Size)).
528532

0 commit comments

Comments
 (0)