Skip to content

Commit

Permalink
chore: Drop useless POST method for now
Browse files Browse the repository at this point in the history
It was initially copied from my ListenBrainz client implementation and
only allows JSON to be posted while the MusicBrainz API only accepts XML.
  • Loading branch information
kellnerd committed Mar 30, 2024
1 parent d1f14a2 commit 928f678
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,28 +164,6 @@ export class MusicBrainzClient {
}
}

/**
* Sends the given JSON data to the given `POST` endpoint.
*
* This method should only be directly called for unsupported endpoints.
*/
// deno-lint-ignore no-explicit-any
async post(endpoint: string, json: any): Promise<any> {
const endpointUrl = new URL(endpoint, this.apiBaseUrl);
const response = await this.#request(endpointUrl, {
method: "POST",
headers: this.#headers,
body: JSON.stringify(json),
});

const data = await response.json();
if (isError(data)) {
throw new ApiError(data.error, response.status);
} else {
return data;
}
}

async #request(url: URL, init?: RequestInit): Promise<Response> {
await this.#rateLimitDelay;

Expand Down

0 comments on commit 928f678

Please sign in to comment.