printStatus(connection: HttpRequest,palette: Theme): string
The whole answer in one line:
200 OK · 101 bytes · 9ms | GET http://localhost:4000/api/users | #3.
The status wears its class as a ground rather than as text, because it is the one thing on the line that is looked for before the line is read. Green for the 2xx, yellow for a redirect, blue for the 4xx — information, not breakage; a 404 is often the answer you went looking for — and red for the 5xx and for a request that never got an answer at all.
The size and the time are painted on the same three-tone scale as everything else here (see
sizeTone and durationTone), so a slow or enormous reply says so before you have
read the number. Then the target, after a dim bar: the request this was, in one info colour.
Then its id, dim, in the spelling that asks for it again — .request #3.
import { printStatus } from './print-request.ts'; const plain = { painter: () => (text: string) => text }; const at = { status: 200, statusText: 'OK', headers: new Map(), body: '{}', bytes: 2, bodyTruncated: false, binary: false }; printStatus({ id: 3, request: { verb: 'GET', url: 'http://x/', headers: new Map(), body: null }, response: at, failed: null, ms: 23, at: 0 }, plain).endsWith('| GET http://x/ | #3'); // true
connection: HttpRequest
palette: Theme