fix(Spotify Node): Fix issue with null values breaking the response (#12080)

This commit is contained in:
Jon
2025-01-09 14:42:27 +00:00
committed by GitHub
parent 1d86c4fdd2
commit a56a46259d
7 changed files with 7223 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ import type {
IHookFunctions,
JsonObject,
IHttpRequestMethods,
IRequestOptions,
IHttpRequestOptions,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow';
@@ -21,7 +21,7 @@ export async function spotifyApiRequest(
query?: IDataObject,
uri?: string,
): Promise<any> {
const options: IRequestOptions = {
const options: IHttpRequestOptions = {
method,
headers: {
'User-Agent': 'n8n',
@@ -29,7 +29,7 @@ export async function spotifyApiRequest(
Accept: ' application/json',
},
qs: query,
uri: uri || `https://api.spotify.com/v1${endpoint}`,
url: uri ?? `https://api.spotify.com/v1${endpoint}`,
json: true,
};
@@ -37,7 +37,7 @@ export async function spotifyApiRequest(
options.body = body;
}
try {
return await this.helpers.requestOAuth2.call(this, 'spotifyOAuth2Api', options);
return await this.helpers.httpRequestWithAuthentication.call(this, 'spotifyOAuth2Api', options);
} catch (error) {
throw new NodeApiError(this.getNode(), error as JsonObject);
}