summaryrefslogtreecommitdiff
path: root/packages/interactions/discord/responses.ts
blob: 4dcc77738eb97f9cef78a97b015516fc05e5d255 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import type { DiscordResponse } from "./interfaces.ts";

export class JSONResponse extends Response {
  constructor(body: DiscordResponse | { error: string }, init?: ResponseInit) {
    const jsonBody = JSON.stringify(body);

    init = init || {
      headers: {
        "content-type": "application/json;charset=UTF-8",
      },
    };

    super(jsonBody, init);
  }
}