C Collections

chttp · Section 3

CHTTP_BODY

CHTTP_BODY - construct a chttp_request_body with an explicit content type

C Collections (libccollections, -lccollections)

#include <ccollections/chttp.h>
 
CHTTP_BODY(data_ptr, data_len, content_type_str)

This macro expands to an initializer for a chttp_request_body built
from the data pointer, the length and the Content-Type string you pass.
 
data_ptr       A pointer to the body bytes. The macro does not copy
               them.
data_len       The length of the body in bytes.
content_type_str  The value string of the Content-Type header.

chttp_request_body body = CHTTP_BODY(buf, len, "application/octet-stream");

CHTTP_JSON_BODY(3), CHTTP_TEXT_BODY(3), CHTTP_NO_BODY(3)