HTTP error codes Lassi Kortela 02 Aug 2020 06:21 UTC

> Your draft makes me think that "HTTP request and response objects"
> should be its own SRFI.

For HTTP errors we could use SRFI 198: Foreign Interface Error Handling.

(make-foreign-error
  'set 'http
  'number 418
  'message "I'm a teapot"
  'http-response #<http-request-object>)

(foreign-error-ref e 'http-resonse) => #<http-request-object>

Is there a standard set of mnemonics for the HTTP status codes? Go uses
these ones: <https://golang.org/pkg/net/http/#pkg-constants>. Each name
just seems like a CamelCase version of the title of that status.

Here's the list of HTTP status codes from IANA:
<https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml>.
I assume it's the official list, but like many IANA lists, it is
incomplete in practice.