aboutsummaryrefslogtreecommitdiffstats
path: root/test/handlers/ranges_provided_auto_h.erl
AgeCommit message (Collapse)Author
2018-11-11Add automatic ranged request handling for bytes unitsLoïc Hoguin
Returning the atom auto instead of a callback informs Cowboy that it needs to handle range requests automatically. This changes the behavior so that the ProvideCallback function is called and then Cowboy splits the data on its own and sends the response without any other user involvement other than defining the ranges_provided/2 callback. This is a quick and dirty way to add range request support to resources, and will be good enough for many cases including for cowboy_static as it also works when the normal response body is a sendfile tuple.