frameworkEngineering & architecture

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.

Download Markdown (.md)

01What 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.[1][2]

Correlated interaction One participant asks; another returns an outcome
  1. ClientMethod, target, metadata
  2. IntermediariesProxy, gateway, cache
  3. ServerAuthorize and process

Status, metadata, optional content

Intermediaries may participate, and the client must interpret the result.

02Why 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.

03When 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.

04How 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.

05A practical example

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.

06Where 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.

07Sources

  1. HTTP Semantics (RFC 9110)RFC Editor · Internet StandardHTTP Semantics (RFC 9110)
  2. HTTP MessagesMDN Web Docs · Official technical documentationHTTP Messages
View saved topics

Start typing to search titles, definitions, categories, and frameworks.