response_state() = start | waiting | on_status | on_headers | on_body
body/1 | Return the full body sent with the request. |
body/2 | Return the full body sent with the request as long as the body length doesn't go over MaxLength. |
close/1 | |
expect_response/1 | handle Expect header. |
maybe_close/1 | |
skip_body/1 | |
skip_multipart/1 | Skip a part returned by the multipart parser. |
start_response/1 | Start the response It parse the request lines and headers. |
stream_body/1 | |
stream_multipart/1 | stream a multipart response. |
body(Client::#client{}) -> {ok, binary(), #client{}} | {error, atom()}
Return the full body sent with the request.
body(MaxLength::non_neg_integer() | infinity, Client::#client{}) -> {ok, binary(), #client{}} | {error, atom()}
Return the full body sent with the request as long as the body length doesn't go over MaxLength.
This is most useful to quickly be able to get the full body while avoiding filling your memory with huge request bodies when you're not expecting it.
When the response is larger than MaxLength, this function will return the body it received up to the last chunk, which might be a bit more than MaxLength.close(Client) -> any()
expect_response(Client) -> any()
handle Expect header
maybe_close(Client) -> any()
skip_body(Client::#client{}) -> {ok, #client{}} | {skip, #client{}} | {error, atom()}
skip_multipart(Client) -> {ok, Client}
Skip a part returned by the multipart parser.
This function repeatedly calls multipart_data/1 until {end_of_part, Req} or {eof, Req} is parsed.start_response(Client) -> any()
Start the response It parse the request lines and headers.
stream_body(Client) -> any()
stream_multipart(Client::#client{}) -> {headers, list(), #client{}} | {body, binary(), #client{}} | {eof | end_of_part | mp_mixed | mp_mixed_eof, #client{}}
stream a multipart response
Use this function for multipart streaming. For each part in the response, this function returns {headers, Headers, Req} followed by a sequence of {body, Data, Req} tuples and finally {end_of_part, Req}. When there is no part to parse anymore, {eof, Req} is returned.Generated by EDoc