all repos — kitten @ 3a1fb0e60b9a5d928ff52958941d627edb43c872

rest: allow passing in a token type
vi did:web:vt3e.cat
Mon, 29 Jun 2026 03:59:52 +0100
commit

3a1fb0e60b9a5d928ff52958941d627edb43c872

parent

2e8b7070a113a5351418031cc7a7507bc65e3fce

2 files changed, 3 insertions(+), 3 deletions(-)

jump to
M pkgs/rest/package.jsonpkgs/rest/package.json

@@ -1,6 +1,6 @@

{ "name": "@purrkit/rest", - "version": "1.1.1", + "version": "1.1.2", "license": "EUPL-1.2", "files": [ "dist",
M pkgs/rest/src/client.tspkgs/rest/src/client.ts

@@ -2,13 +2,13 @@ import type { ApiResponse, DiscordError, DiscordRestClient } from "./types";

export interface ClientOptions { token: string; + tokenType?: "Bot" | "Bearer"; baseUrl?: string; fetch?: (input: RequestInfo | URL | string, init?: RequestInit) => Promise<Response>; } export function RESTClient(options: ClientOptions): DiscordRestClient { const baseUrl = options.baseUrl || "https://discord.com/api/v10"; - const customFetch = options.fetch ?? globalThis.fetch; const executeRequest = async (

@@ -41,7 +41,7 @@ try {

const isFormData = typeof FormData !== "undefined" && body instanceof FormData; const reqHeaders: Record<string, string> = { - Authorization: `Bot ${options.token}`, + Authorization: `${options.tokenType ?? "Bot"} ${options.token}`, ...headers, };