Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix to return 206 status when responding a partial body

  • Loading branch information...
commit f88204daa361f886862cdd311dccce7cb57a1182 1 parent 46d05f0
@mocchira mocchira authored
View
2  src/leo_gateway_http_commons.erl
@@ -669,7 +669,7 @@ get_range_object(Req, Bucket, Key, {_Unit, Range}) when is_list(Range) ->
Mime = leo_mime:guess_mime(Key),
Header = [?SERVER_HEADER,
{?HTTP_HEAD_RESP_CONTENT_TYPE, Mime}],
- {ok, Req2} = cowboy_req:chunked_reply(?HTTP_ST_OK, Header, Req),
+ {ok, Req2} = cowboy_req:chunked_reply(?HTTP_ST_PARTIAL_CONTENT, Header, Req),
get_range_object_1(Req2, Bucket, Key, Range, undefined).
get_range_object_1(Req,_Bucket,_Key, [], _) ->
View
2  test/leo_gateway_web_tests.erl
@@ -513,7 +513,7 @@ range_object_base([_TermFun, _Node0, Node1], RangeValue) ->
?TARGET_HOST,
":8080/a/b.png"]),
[{"connection", "close"},{"range", RangeValue}]}, [], []),
- ?assertEqual(200, SC),
+ ?assertEqual(206, SC),
?assertEqual("od", Body)
catch
throw:Reason ->
Please sign in to comment.
Something went wrong with that request. Please try again.