Skip to content

HTTP body types ​

An HTTP message body is a sequence of bytes that comes after the headers.

Both requests and responses can have bodies.

Below are the HTTP request body types supported by Pororoca.

None ​

An HTTP message can have no body.

Raw ​

In this case, a text is converted into UTF-8 bytes, which become the request body.

In Pororoca, it is necessary to specify its MIME type. For example, a JSON raw body uses application/json as its MIME type.

File ​

For this case, the bytes of a file will become the request body.

The MIME type is also required (Pororoca can infer MIME types from file extensions).

Form URL encoded ​

They are simple key-value pairs of texts that are converted into URL-encoded strings, paired with = and joined with &.

The MIME type is always application/x-www-form-urlencoded.

Consider the following key-value pairs:

KeyValue
axyz
b123
cabc à é

The resulting request body will be the UTF-8 bytes of the string: a=xyz&b=123&c=abc+%C3%A0+%C3%A9.

Multipart form data ​

This is a more complex kind of body. It is divided in parts delimited by boundaries and each part has its own MIME type. The boundary is auto-generated and is usually a GUID.

In Pororoca, a part can either be a raw text or a content from a file.

The final request is something like:

POST /test HTTP/1.1
Host: foo.example
Content-Type: multipart/form-data; boundary="9e0248d8-f117-404e-a46b-51f0382d00bd"

--9e0248d8-f117-404e-a46b-51f0382d00bd
Content-Type: text/plain
Content-Disposition: form-data; name="field1"

value1
--9e0248d8-f117-404e-a46b-51f0382d00bd
Content-Type: image/gif
Content-Disposition: form-data; name="field2"; filename="pirate.gif"

(pirate.gif file bytes)
--9e0248d8-f117-404e-a46b-51f0382d00bd--

GraphQL ​

GraphQL is a data query syntax that allows to specify which fields of information are wanted, to avoid searching data that is not relevant.

It is composed by a query and its variables, both according to GraphQL syntax.

The resulting request body will be a JSON, like:

json
{
  "query": "(your GraphQL query)",
  "variables": "(your GraphQL variables)"
}