All files / packages / shared/src http.ts

100% Statements 2/2
100% Branches 0/0
100% Functions 0/0
100% Lines 2/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26  2x     2x                                          
// The Worker puts the request id on every response; the SPA reads it when an error has no body.
export const REQUEST_ID_HEADER = 'x-request-id'
 
// The statuses the API answers with or the clients act on; Hono ships only their types.
export const HTTP_STATUS = {
  switchingProtocols: 101,
  ok: 200,
  created: 201,
  noContent: 204,
  badRequest: 400,
  unauthorized: 401,
  forbidden: 403,
  notFound: 404,
  conflict: 409,
  upgradeRequired: 426,
  tooManyRequests: 429,
  internalServerError: 500,
  badGateway: 502,
  serviceUnavailable: 503,
} as const
 
// What turns an unknown JSON body into a typed value. A zod schema fits.
export interface Decoder<T> {
  parse(data: unknown): T
}