From 31c6f0b0632bc231128c6eea39df8f6cd62a31ef Mon Sep 17 00:00:00 2001 From: Marcel Overdijk Date: Tue, 3 Sep 2024 17:59:02 +0200 Subject: [PATCH] feat(context): added application json constant --- src/context.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/context.ts b/src/context.ts index e3dbc3c5..882103c9 100644 --- a/src/context.ts +++ b/src/context.ts @@ -328,6 +328,8 @@ interface ResponseInit { export const TEXT_PLAIN = 'text/plain; charset=UTF-8' +export const APPLICATION_JSON = 'application/json; charset=UTF-8' + /** * Sets the headers of a response. * @@ -828,7 +830,7 @@ export class Context< ): JSONRespondReturn => { const body = JSON.stringify(object) this.#preparedHeaders ??= {} - this.#preparedHeaders['content-type'] = 'application/json; charset=UTF-8' + this.#preparedHeaders['content-type'] = APPLICATION_JSON /* eslint-disable @typescript-eslint/no-explicit-any */ return ( typeof arg === 'number' ? this.newResponse(body, arg, headers) : this.newResponse(body, arg)