# Request and Response

An interaction model in which a client sends a message asking for an operation and a server returns a message describing the outcome.

- Type: framework
- Domain: Engineering & architecture
- Level: Foundational
- Last reviewed: 2026-09-23
- Original: [Soroush’s Product Wiki](<https://wiki.soroush.uk/topic/request-and-response/>)

## What it means

Request-response is an interaction pattern where one participant sends a request and another returns a corresponding response. In HTTP, a request carries a method, target, header fields, and optional content; the response carries a status code, header fields, and optional content. Either message may pass through intermediaries.

## Why it matters

The pattern is the basic unit of most web and API behavior. Understanding both messages helps teams define contracts, trace latency, handle partial failure, secure data, diagnose errors, and distinguish transport success from business success.

## When to use it

Use request-response when a caller needs a direct result, acknowledgement, or representation from a known service. Prefer events, queues, or streaming when work is long-running, receivers are loosely coupled, or many updates must arrive without repeated requests.

## How it works

1. The client constructs a request containing the operation, target, metadata, credentials, and any content.
2. The request travels to the server, possibly through name resolution, proxies, gateways, load balancers, and caches.
3. The server validates and processes the request, including authorization and application rules.
4. The server sends a response describing the outcome with status, metadata, and optional content.
5. The client interprets the response, updates its state, and decides whether to finish, retry, redirect, or report an error.

## A practical example

A mobile app requests an account balance. The server authenticates the request and returns a status, cache restrictions, content type, and JSON representation. If the app times out, it cannot infer from silence alone whether the server processed a state-changing request.

## Where it breaks

The model can create temporal coupling because the caller waits for a responder. Timeouts and broken connections create ambiguous outcomes, long chains amplify latency and failure, and polling is inefficient for frequent server-originated updates.

## Common mistakes

- Treating a request body as the whole request and ignoring method, target, headers, and identity.
- Assuming no received response means the server did not execute the operation.
- Equating a transport-level success response with successful completion of the user's goal.
- Building long synchronous call chains without timeout, retry, and failure-boundary design.

## Visualization

[View the visualization on the website](<https://wiki.soroush.uk/topic/request-and-response/#visualization-request-and-response>)

## Sources

1. [HTTP Semantics \(RFC 9110\)](<https://www.rfc-editor.org/rfc/rfc9110>) — RFC Editor · Internet Standard
2. [HTTP Messages](<https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Messages>) — MDN Web Docs · Official technical documentation

## Related topics

- [Client and Server](<https://wiki.soroush.uk/topic/client-and-server/>)
- [HTTP](<https://wiki.soroush.uk/topic/http/>)
- [Webhook](<https://wiki.soroush.uk/topic/webhook/>)
