erlang/otp

httpc:request full_result option does not work in async mode

Xavier59 opened this issue · 1 comments

Describe the bug
As per erlang documentation on httpc:request options:

full_result - Defines if a "full result" is to be returned to the caller (that is, the body, the headers, and the entire status line) or not (the body and the status code).

Default is true.

It it not specified that it does not apply if the request is async. The logical conclusion is that it applies to both.

To Reproduce
Steps to reproduce the behavior.

inets:start(),
httpc:request(get, {"http://example.com/", []}, [], [{full_result, false}]),
httpc:request(get, {"http://example.com/", []}, [], [{full_result, false}, {sync, false}, {receiver, fun(ReplyInfo) -> io:format("~p", [ReplyInfo]) end}]).

Expected behavior
Both request should have a result of the type {StatusCode, HttpBodyResult}
However, first request has a result of the type {StatusCode, HttpBodyResult} but second request (async) has a result of the type {StatusLine, [HttpHeader], HttpBodyResult}

Either the return of async request should be {StatusCode, HttpBodyResult} or the documentation should be clarified.

Affected versions
Latest

@Xavier59 hum we will look into it.