From 630bd475e6aa4b9fdde01272236d08305034cb48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Mon, 31 Dec 2018 17:08:59 +0100 Subject: Separate request/4,5,6 into headers/4,5 and request/5,6 This cleaner separation gets rid of the implicit body check that was causing issues for many users. Now the body is either given explicitly or it is expected via future gun:data/3 calls. --- doc/src/guide/http.asciidoc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'doc/src/guide') diff --git a/doc/src/guide/http.asciidoc b/doc/src/guide/http.asciidoc index 652030a..fb0c7dc 100644 --- a/doc/src/guide/http.asciidoc +++ b/doc/src/guide/http.asciidoc @@ -108,7 +108,7 @@ desirable. The request body of a PATCH method may be a partial representation or a list of instructions on how to update the resource. -The `gun:post/4,5`, `gun:put/4,5` and `gun:patch/4,5` functions +The functions `gun:post/4,5`, `gun:put/4,5` and `gun:patch/4,5` take a body as their fourth argument. These functions do not require any body-specific header to be set, although it is always recommended to set the content-type header. @@ -127,13 +127,9 @@ StreamRef = gun:post(ConnPid, "/organizations/ninenines", [ ], Body). ---- -The `gun:post/3`, `gun:put/3` and `gun:patch/3` functions -do not take a body in their arguments. If a body is to be -provided later on, using the `gun:data/4` function, then -the request headers must indicate this. This can be done -by setting the content-length or content-type request -headers. If these headers are not set then Gun will assume -the request has no body. +The functions `gun:post/3,4`, `gun:put/3,4` and `gun:patch/3,4` +do not take a body in their arguments: the body must be +provided later on using the `gun:data/4` function. It is recommended to send the content-length header if you know it in advance, although this is not required. If it -- cgit v1.2.3