|
@@ -45,27 +45,27 @@ init_dispatch(_) ->
|
|
|
|
|
|
%% Tests.
|
|
%% Tests.
|
|
|
|
|
|
-long_polling(Config) ->
|
|
|
|
- doc("Simple long-polling."),
|
|
|
|
|
|
+info_read_body(Config) ->
|
|
|
|
+ doc("Check that a loop handler can read the request body in info/3."),
|
|
ConnPid = gun_open(Config),
|
|
ConnPid = gun_open(Config),
|
|
- Ref = gun:get(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}]),
|
|
|
|
- {response, fin, 299, _} = gun:await(ConnPid, Ref),
|
|
|
|
|
|
+ Ref = gun:post(ConnPid, "/loop_body", [{<<"accept-encoding">>, <<"gzip">>}],
|
|
|
|
+ << 0:100000/unit:8 >>),
|
|
|
|
+ {response, fin, 200, _} = gun:await(ConnPid, Ref),
|
|
ok.
|
|
ok.
|
|
|
|
|
|
-long_polling_body(Config) ->
|
|
|
|
- doc("Long-polling with a body that falls within the configurable limits."),
|
|
|
|
|
|
+long_polling(Config) ->
|
|
|
|
+ doc("Simple long-polling."),
|
|
ConnPid = gun_open(Config),
|
|
ConnPid = gun_open(Config),
|
|
- Ref = gun:post(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}],
|
|
|
|
- << 0:5000/unit:8 >>),
|
|
|
|
|
|
+ Ref = gun:get(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}]),
|
|
{response, fin, 299, _} = gun:await(ConnPid, Ref),
|
|
{response, fin, 299, _} = gun:await(ConnPid, Ref),
|
|
ok.
|
|
ok.
|
|
|
|
|
|
-long_polling_body_too_large(Config) ->
|
|
|
|
- doc("Long-polling with a body that exceeds the configurable limits."),
|
|
|
|
|
|
+long_polling_unread_body(Config) ->
|
|
|
|
+ doc("Long-polling with a body that is not read by the handler."),
|
|
ConnPid = gun_open(Config),
|
|
ConnPid = gun_open(Config),
|
|
Ref = gun:post(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}],
|
|
Ref = gun:post(ConnPid, "/long_polling", [{<<"accept-encoding">>, <<"gzip">>}],
|
|
<< 0:100000/unit:8 >>),
|
|
<< 0:100000/unit:8 >>),
|
|
- {response, fin, 500, _} = gun:await(ConnPid, Ref),
|
|
|
|
|
|
+ {response, fin, 299, _} = gun:await(ConnPid, Ref),
|
|
ok.
|
|
ok.
|
|
|
|
|
|
long_polling_pipeline(Config) ->
|
|
long_polling_pipeline(Config) ->
|
|
@@ -76,15 +76,7 @@ long_polling_pipeline(Config) ->
|
|
_ = [{response, fin, 299, _} = gun:await(ConnPid, Ref) || Ref <- Refs],
|
|
_ = [{response, fin, 299, _} = gun:await(ConnPid, Ref) || Ref <- Refs],
|
|
ok.
|
|
ok.
|
|
|
|
|
|
-loop_body(Config) ->
|
|
|
|
- doc("Check that a loop handler can read the request body in info/3."),
|
|
|
|
- ConnPid = gun_open(Config),
|
|
|
|
- Ref = gun:post(ConnPid, "/loop_body", [{<<"accept-encoding">>, <<"gzip">>}],
|
|
|
|
- << 0:100000/unit:8 >>),
|
|
|
|
- {response, fin, 200, _} = gun:await(ConnPid, Ref),
|
|
|
|
- ok.
|
|
|
|
-
|
|
|
|
-loop_request_timeout(Config) ->
|
|
|
|
|
|
+request_timeout(Config) ->
|
|
doc("Ensure that the request_timeout isn't applied when a request is ongoing."),
|
|
doc("Ensure that the request_timeout isn't applied when a request is ongoing."),
|
|
ConnPid = gun_open(Config),
|
|
ConnPid = gun_open(Config),
|
|
Ref = gun:get(ConnPid, "/loop_timeout", [{<<"accept-encoding">>, <<"gzip">>}]),
|
|
Ref = gun:get(ConnPid, "/loop_timeout", [{<<"accept-encoding">>, <<"gzip">>}]),
|