Requests

Sending, stopping, and replaying requests

Send a request, stop one that's in progress and send a past request again.

Overview

When you send a request, Relay runs its scripts, fills in its variables and authentication, sends it, and shows the response in the response inspector. Every request you send is recorded in History, so you can look at it later or send it again.

Send a request

Click Send at the end of the URL bar, or press Command-Return. You can also choose Request > Send Request, or press Return in the URL field.

Send is unavailable until the request has a URL. While the request is in progress, the response inspector shows its progress, and the previous response, if there is one, stays until the new one arrives. If you send the request again before it finishes, the new send replaces the one in progress.

What happens when you send

Relay works through these steps in order:

  1. Runs the pre-request scripts of the request's collection, its folders and the request itself. For more information, see Running scripts before and after requests.
  2. Replaces each variable, such as {{baseUrl}}, with its value, and generates dynamic values such as {{$guid}}. A variable without a value is sent as written.
  3. Applies the request's authentication, inherited or its own, and gets an OAuth 2.0 access token first if it needs one.
  4. Sends the request, following redirects and using the proxy and certificate settings that apply to it.
  5. Runs the post-response scripts.
  6. Stores the cookies the server set, unless cookies are turned off for the workspace.
  7. Shows the response and records the request in History.

History keeps the request as you wrote it, with its variable tokens, and the response along with the request exactly as it was sent.

Understand a failed request

When a request doesn't get a response, the status badge shows why instead of a status code, for example "The request timed out." or "Could not connect to the server." The failure is recorded in History like any other response, and post-response scripts don't run.

A request also stops before it's sent when a pre-request script fails or skips the request, or when Relay can't build it, for example because the URL isn't valid or a file in a multipart body can't be read. The status badge shows the reason, and the Tests tab shows what the scripts reported.

A request times out when the server sends nothing for as long as its timeout allows, 30 seconds unless you change it. For more information, see Configuring request settings.

Stop a request

After a request has been in progress for a second, Send becomes Stop. Click Stop, or press Command-Period. You can also choose Request > Cancel Request.

Relay abandons a cancelled request: it records nothing in History, and the previous response stays in the response inspector.

A response that's a server-sent event stream works differently. While it streams, Stop and Command-Period stop the stream, and the Request menu item is Stop Stream. Relay keeps the events that arrived, runs the post-response scripts and records the response in History. For more information, see Receiving server-sent events.

Send a past request again

  1. In the sidebar, select a request in History.

    The request editor shows the request as it was sent, and the response inspector shows the response it got.

  2. Click Send, or press Command-Return.

Relay sends the request as it was written, with its variables filled in from their current values, and records the result as a new History entry, which the window then shows. The original entry doesn't change.

To change a past request before you send it again, click the Edit as New Draft button at the end of the URL bar, or choose Request > Convert to Draft. Relay copies the request, and its response, into a new draft that you can edit.

A recorded WebSocket connection can't be sent again from History. To connect again, open the original request. For more information, see Reviewing request history.

See Also