HTTP requests
An HTTP request is a method, a URL, optional query parameters, path variables, headers and a body. It also has authorization, scripts, tests and per-request settings.
This page covers the builder tab, what Postguy sends, and how the response is shown and recorded.
Request tabs: Params, Authorization, Headers, Body, Scripts, Tests, Settings and Docs.
- Authorization: Authorization
- Scripts and tests: Scripts and tests
Send a request
The top row has the method menu, the URL field and the Send button.
- Methods:
GET,POST,PUT,PATCH,DELETE,HEAD,OPTIONS. Any other method is rejected when the request is built. - Send: click
Send, pressEnterin the URL field, or pressCmd/Ctrl+Enter. The split button's menu hasSend and Download. It also saves the body when the response arrives (see Save a response). - Cancel: while a request runs,
SendbecomesCanceland a progress line runs over the URL bar. A cancel reports the phase it stopped in. - Save: press
Cmd/Ctrl+S, or clickSave. A dot beside it marks unsaved changes. Sending uses the current draft, so you do not have to save first. - cURL paste: paste a command that starts with
curlinto the URL field to import it into the request. - No scheme: a URL without a scheme is sent as
http://<url>.
Sending uses the active environment from the selector at the end of the tab strip. See Variables.
URL, query params and path variables
The URL and the Params tab stay in sync:
- Type
?a=1in the URL to add a row. - Edit a row to update the URL.
- The
Path Variablestable lists every:namesegment in the URL path.
{{baseUrl}}/users/:userId/orders?status=open
When you send the request, Postguy does this:
- Resolves
{{variables}}in the URL. An unresolved variable in the host is an error. Elsewhere it stays literal. - Replaces
:namesegments with the value in thePath Variablestable. A row with an empty value leaves:namein place. - Merges enabled query rows into the URL. A row replaces a pair with the same key. Pairs that exist only in the URL are kept. Disabled rows are not sent.
- Converts the host to ASCII (IDNA). Values of enabled query rows and path variables are percent-encoded.
Turn off Encode URL automatically in the request Settings tab to skip percent-encoding of query and path values.
Bulk Edit turns the table into key: value lines.
Headers
The Headers tab has:
- Editable rows. Disabled rows are not sent.
Bulk Edit.- A
Presetsmenu with four built-in sets:JSON,XML,Form URL EncodedandNo cache. Custom presets are not available yet.
Header names and values may contain {{variables}}.
A name with a space, a colon or a control character is refused before sending. So is a value with a line break.
Rows you add go on the wire first, in table order. Then Postguy adds the automatic headers below. It skips any header whose name you already set (names are compared case-insensitively).
| Header | Value |
|---|---|
Host | Authority of the final URL |
User-Agent | Postguy/<version> |
Accept | */* |
Accept-Encoding | gzip, deflate, br |
Connection | keep-alive |
Cache-Control | no-cache, only while Settings › General › Send no-cache header is on |
Content-Type | From the body mode (see below), only when the body mode sets one |
Content-Length | Body size in bytes, only when the body is not empty |
Cookie | Added from the cookie jar. A Cookie row you set is merged in |
Tick Show auto-generated headers in the Headers tab to see the generated rows. They are never saved with the request.
Body
Pick the mode from the Body type menu on the Body tab. Switching mode keeps the other modes' content until you save. Only the active mode is stored.
| Mode | What is sent | Content-Type |
|---|---|---|
None | No body | none |
form-data | Multipart with a generated boundary. Rows are text or file. | multipart/form-data; boundary=postguy-boundary-... |
x-www-form-urlencoded | key=value pairs joined with &, percent-encoded. Rows with an empty key and value are skipped. | application/x-www-form-urlencoded |
Raw | The text as typed | By language (below) |
Binary | The bytes of one file | none (set it yourself in Headers) |
GraphQL | JSON {"query", "variables", "operationName"} | application/json |
Raw languages set a Content-Type when you have not set one yourself:
| Language | Content-Type |
|---|---|
Text | text/plain |
JSON | application/json |
JavaScript | application/javascript |
HTML | text/html |
XML | application/xml |
Beautify re-indents a JSON raw body.
form-data rows. A text row can have its own content type. A file row sends the file's name and application/octet-stream, unless the row has a content type.
GraphQL.
Variablesmust be a JSON object. Empty or invalid text is sent as{}, and a warning goes to the Console.Operation nameis sent only when it is not empty.Refresh schemaruns an introspection query against the URL and lists the types in the tab.
Variables and shortcodes. {{variables}} resolve in every body mode. Shortcodes such as {{% base64(file('lib/a.jpg')) %}} expand in raw, urlencoded, form-data text and GraphQL bodies.
Files and the working directory
Binary bodies and form-data file rows read a file from disk.
- Relative paths resolve against the working directory. It is
<workspace>/filesunless you set another in Settings › General. - Files outside the working directory are refused, unless
Read files outside the working directoryis on. - A file is capped at 100 MiB.
A file row or binary path that is exactly {{% file('name') %}} reads name from the collection's assets instead of the disk. Any other shortcode in a file path is an error.
Per-request settings
The Settings tab holds the values below. A new request gets the defaults.
| Setting | Default | Notes |
|---|---|---|
| HTTP version | Auto | Auto, HTTP/1.x, HTTP/2. Auto follows the global setting. |
| Enable SSL certificate verification | on | |
| Automatically follow redirects | on | |
| Follow original HTTP method | off | Off: 301 and 302 turn a POST into a GET. 303 always becomes a GET (HEAD stays HEAD). 307 and 308 keep the method. |
| Follow Authorization header on cross-host redirects | off | Off: Authorization is dropped when the scheme, host or port changes. |
| Remove referer header on redirect | off | |
| Encode URL automatically | on | |
| Disable cookie jar | off | Stops both sending and storing cookies for this request. |
| Maximum redirects | 10 | 0 to 100 in the UI. |
| Request timeout (ms) | 0 | 0 = no timeout. Up to 3,600,000 in the UI. |
| Max response size (MB) | 50 | 0 = unlimited. Up to 1,024 in the UI. |
Redirect and cookie behaviour is described in Cookies, proxy and certificates.
How global settings combine
Global values live in Settings. For each send, Postguy combines them with the request's values:
| Value | Rule |
|---|---|
| SSL verification | On only if it is on globally and in the request. Off on either side wins. |
| Follow redirects | Followed only if it is on in both. |
| Disable cookies | Disabled if the request or the global setting disables them. |
| Timeout | The request's value if it is not 0. Otherwise the global Request timeout. |
| Max response size | The request's value if it differs from 50. Otherwise the global value. |
| HTTP version | The request's value, or the global value when the request says Auto. |
Other redirect rules, Encode URL automatically, Maximum redirects | Request only. |
50 means "default". So a request that wants exactly 50 MB while the global limit is different cannot say so.The send pipeline
Every send runs the same twelve steps. This is true from the app, the runner or a tool.
| # | Step |
|---|---|
| 1 | Find the request and load the variable scopes: globals, collection, folders, active environment, data row, runtime. |
| 2 | Run pre-request scripts: collection, then folders outer to inner, then the request. A script can change the request or skip it. |
| 3 | Resolve inherited authorization and its variables. An expired OAuth 2.0 token with a refresh token is refreshed. |
| 4 | Build the URL: resolve variables, path variables, query rows, IDNA host, percent-encoding. |
| 5 | Resolve header rows. Authorization is applied after the body is built, because OAuth 1.0, AWS Signature v4 and Hawk sign the body. |
| 6 | Build the body and the automatic headers. |
| 7 | Cookies: the jar's cookies first, then a manual Cookie row. |
| 8 | Send through the proxy-aware client. Redirects are followed by hand and cookies are captured on every hop. A Digest 401 challenge is answered once. |
| 9 | Save the cookie jar if a cookie was stored. |
| 10 | Build the response model: status, headers, decoded body, sizes and timings. |
| 11 | Run post-response scripts and tests. A failing script or test never discards the response. |
| 12 | Record the History entry, the Console entries and, if enabled, the response body. |
If Settings › Disable scripts is on, steps 2 and 11 are skipped and a warning is written to the Console.
Response viewer
The response pane has the tabs Body, Cookies, Headers and Test Results. After a test has run, the last one shows as Test Results (passed/total).
The status badge, size and time sit on the right. Hover them to see:
- The HTTP version and redirect count.
- The header and body sizes, and the wire size if the body was compressed.
- The connect, wait (TTFB), download and total times.
| Feature | Notes |
|---|---|
| Body views | Pretty, Raw, Preview, Hex. |
| Syntax colouring | JSON, XML, HTML, JavaScript, YAML, chosen from the response. |
| Large bodies | Above 5 MB, Pretty is disabled and the body opens in Raw with a banner. |
| Search | A search box with a match count. Matches are tinted in the body. |
| Wrap | Wrap toggle. |
| Copy | Copy body and Copy headers in the ... menu. |
| Clear | Clear response in the ... menu. |
| Headers | A two-column table. |
| Cookies | The parsed Set-Cookie headers of this response. |
Save a response
Save Response (or Save body to file in the ... menu) writes the decoded body to <workspace>/files/response-<tab id>.bin. The path shows in the status bar.
Send and Download does the same after the send completes.
History and Console
Each send is recorded, unless it comes from the collection runner.
- History. The sidebar's History section lists sends newest first, with method, URL and time.
- An entry stores the request as sent (secret values masked), the status, duration and size.
- The newest 5,000 entries are kept.
- Open or delete an entry from its context menu.
- Response bodies are stored under
.postguy/responses/only whenSave response bodies in historyis on in Settings › General.
- Console. Open it from the bottom bar. It logs each request as
METHOD URL -> status · ms · bytes.- It shows expandable request headers, response headers and body (a body is cut at 1 MiB), the effective proxy, and any warnings.
- Secret values are masked.
- It keeps up to 5,000 entries for 24 hours.
See Workspace for where these files live.
request_createmakes a request.request_updatesets itsdefinition.request_sendruns the full pipeline above and takes an optionalenvironmentid.request_cancelstops it.- Read the result with
response_get,response_render_bodyandresponse_save. - Read the record with
history_list,history_open,console_getandcookies_list. snippet_generateproduces code for a request.variables_resolvepreviews a template.