Skip to content

Commit dbc1249

Browse files
woyliebenoitc
authored andcommitted
improve docs and type spec (#579)
1 parent 2a217e4 commit dbc1249

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

doc/hackney.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ make a request
273273
### request/5 ###
274274

275275
<pre><code>
276-
request(Method::term(), Hackney_url::<a href="#type-url">url()</a> | binary() | list(), Headers0::list(), Body::term(), Options0::list()) -&gt; {ok, integer(), list(), <a href="#type-client_ref">client_ref()</a>} | {ok, integer(), list()} | {ok, <a href="#type-client_ref">client_ref()</a>} | {error, term()}
276+
request(Method::term(), Hackney_url::<a href="#type-url">url()</a> | binary() | list(), Headers0::list(), Body::term(), Options0::list()) -&gt; {ok, integer(), list(), <a href="#type-client_ref">client_ref()</a>} | {ok, integer(), list(), binary()} | {ok, integer(), list()} | {ok, <a href="#type-client_ref">client_ref()</a>} | {error, term()}
277277
</code></pre>
278278
<br />
279279

@@ -392,19 +392,22 @@ to connect to an HTTP tunnel.
392392

393393

394394

395-
<bloquote>Note: instead of doing `hackney:request(Method, ...)` you can
395+
<blockquote>Note: instead of doing `hackney:request(Method, ...)` you can
396396
also do `hackney:Method(...)` if you prefer to use the REST
397-
syntax.</bloquote>
397+
syntax.</blockquote>
398398

399399
Return:
400400

401401
* `{ok, ResponseStatus, ResponseHeaders}`: On HEAD
402402
request if the response succeeded.
403403

404-
* `{ok, ResponseStatus, ResponseHeaders, Ref}`: when
404+
* `{ok, ResponseStatus, ResponseHeaders, Ref}`: When
405405
the response succeeded. The request reference is used later to
406406
retrieve the body.
407407

408+
* `{ok, ResponseStatus, ResponseHeaders, Body}`: When the
409+
option `with_body` is set to true and the response succeeded.
410+
408411
* `{ok, Ref}` Return the request reference when you
409412
decide to stream the request. You can use the returned reference to
410413
stream the request body and continue to handle the response.
@@ -642,3 +645,4 @@ stream_next(Ref::<a href="#type-client_ref">client_ref()</a>) -&gt; ok | {error,
642645

643646
continue to the next stream message. Only use it when
644647
`{async, once}` is set in the client options.
648+

src/hackney.erl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,17 +272,19 @@ request(Method, URL, Headers, Body) ->
272272
%% </li>
273273
%% </ul>
274274
%%
275-
%% <bloquote>Note: instead of doing `hackney:request(Method, ...)' you can
275+
%% <blockquote>Note: instead of doing `hackney:request(Method, ...)' you can
276276
%% also do `hackney:Method(...)' if you prefer to use the REST
277-
%% syntax.</bloquote>
277+
%% syntax.</blockquote>
278278
%%
279279
%% Return:
280280
%% <ul>
281281
%% <li><code>{ok, ResponseStatus, ResponseHeaders}</code>: On HEAD
282282
%% request if the response succeeded.</li>
283-
%% <li><code>{ok, ResponseStatus, ResponseHeaders, Ref}</code>: when
283+
%% <li><code>{ok, ResponseStatus, ResponseHeaders, Ref}</code>: When
284284
%% the response succeeded. The request reference is used later to
285285
%% retrieve the body.</li>
286+
%% <li><code>{ok, ResponseStatus, ResponseHeaders, Body}</code>: When the
287+
%% option `with_body' is set to true and the response succeeded.</li>
286288
%% <li><code>{ok, Ref}</code> Return the request reference when you
287289
%% decide to stream the request. You can use the returned reference to
288290
%% stream the request body and continue to handle the response.</li>
@@ -294,6 +296,7 @@ request(Method, URL, Headers, Body) ->
294296
%% </ul>
295297
-spec request(term(), url() | binary() | list(), list(), term(), list())
296298
-> {ok, integer(), list(), client_ref()}
299+
| {ok, integer(), list(), binary()}
297300
| {ok, integer(), list()}
298301
| {ok, client_ref()}
299302
| {error, term()}.

0 commit comments

Comments
 (0)