Workshop index · Download all examples and lessons
The request adapter accepts a decoded JSON object, validates seats, calls the booking service, and returns an HTTP-shaped {status, body} response. It does not open a network port.
Contract: an omitted seats field defaults to one. A supplied value must be an integer greater than zero. Reject null, booleans, strings, fractional numbers, zero, and negative numbers with status 400. A valid request returns 201 when confirmed or 409 when sold out. The booking service from lesson 1 remains unchanged.
The baseline is the complete adapter. The candidate intends to simplify its defaulting expression without changing behaviour. Use this exercise in lessons 3 and 4.
git diff --no-index exercises/03-request/baseline/python/adapter.py exercises/03-request/candidate/python/adapter.py
python3 exercises/03-request/smoke.py
git diff --no-index exercises/03-request/baseline/typescript/adapter.ts exercises/03-request/candidate/typescript/adapter.ts
node --test exercises/03-request/smoke.test.ts