mirror of
https://github.com/honojs/hono.git
synced 2024-11-21 18:18:57 +01:00
feat(context): added application json constant
This commit is contained in:
parent
350040470d
commit
31c6f0b063
@ -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<T, U> => {
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user