What is the problem this feature would solve?
TypeScript programs often depend on HTTP response status codes — the server decides which status to respond with, and clients branch their logic based on it. When writing or reading this kind of code, you need to remember what codes like 409 mean, which usually means googling it or asking an agent. Using named constants instead of raw numbers (e.g. HttpStatus.Conflict) lets you rely on IDE autocompletion instead, and makes the code more readable.
What is the feature you are proposing to solve the problem?
It would be nice for Effect (the "missing standard library") to have a module (new or existing) with exports of all known HTTP status codes:
import { HttpStatus } from 'effect'
export default {
async fetch(request) {
if (someCondition(request)) {
return new Response('good', { status: HttpStatus.OK })
} else {
return new Response('bad', { status: HttpStatus.Conflict })
}
}
}
What alternatives have you considered?
- Defining constants for status codes manually in a project
- Installing and importing status codes from packages like http-status-codes
What is the problem this feature would solve?
TypeScript programs often depend on HTTP response status codes — the server decides which status to respond with, and clients branch their logic based on it. When writing or reading this kind of code, you need to remember what codes like 409 mean, which usually means googling it or asking an agent. Using named constants instead of raw numbers (e.g. HttpStatus.Conflict) lets you rely on IDE autocompletion instead, and makes the code more readable.
What is the feature you are proposing to solve the problem?
It would be nice for Effect (the "missing standard library") to have a module (new or existing) with exports of all known HTTP status codes:
What alternatives have you considered?