diff options
Diffstat (limited to 'u/server/response.ts')
-rw-r--r-- | u/server/response.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/u/server/response.ts b/u/server/response.ts index c21819a..9022fed 100644 --- a/u/server/response.ts +++ b/u/server/response.ts @@ -20,19 +20,19 @@ const getResponse = ( return { ...opts, headers: { - ...(req.baseResponseHeaders()), - ...(opts?.headers), - "Content-Type": (opts?.headers?.["Content-Type"] ?? "text/plain") + - "; charset=utf-8", + ...req.baseResponseHeaders(), + ...opts?.headers, + "Content-Type": + (opts?.headers?.["Content-Type"] ?? "text/plain") + "; charset=utf-8", }, }; }; const ResponseCodeMetrics = [1, 2, 3, 4, 5].map((x) => - Metric.fromName(`response.${x}xx`) + Metric.fromName(`response.${x}xx`), ); export const getResponseMetric = (status: number) => { - const index = (Math.floor(status / 100)) + 1; + const index = Math.floor(status / 100) + 1; return ResponseCodeMetrics[index] ?? ResponseCodeMetrics[5 - 1]; }; @@ -67,7 +67,7 @@ export class JsonResponse extends PenguenoResponse { super( req, JSON.stringify( - e.fold((err, ok) => err ? ({ error: err! }) : ({ ok: ok! })), + e.fold((err, ok) => (err ? { error: err! } : { ok: ok! })), ), optsWithJsonContentType, ); @@ -76,7 +76,7 @@ export class JsonResponse extends PenguenoResponse { super( req, JSON.stringify( - (Math.floor(opts.status / 100) < 4) ? { ok: e } : { error: e }, + Math.floor(opts.status / 100) < 4 ? { ok: e } : { error: e }, ), optsWithJsonContentType, ); |