fix: send proper URL params
This commit is contained in:
@@ -60,7 +60,7 @@ class ExternalAPI {
|
||||
}
|
||||
|
||||
const url = this.formatUrl(endpoint, params);
|
||||
const response = await fetch(url.href, {
|
||||
const response = await fetch(url, {
|
||||
...config,
|
||||
headers: {
|
||||
...this.defaultHeaders,
|
||||
@@ -93,7 +93,7 @@ class ExternalAPI {
|
||||
}
|
||||
|
||||
const url = this.formatUrl(endpoint, params);
|
||||
const response = await fetch(url.href, {
|
||||
const response = await fetch(url, {
|
||||
method: 'POST',
|
||||
...config,
|
||||
headers: {
|
||||
@@ -128,7 +128,7 @@ class ExternalAPI {
|
||||
}
|
||||
|
||||
const url = this.formatUrl(endpoint, params);
|
||||
const response = await fetch(url.href, {
|
||||
const response = await fetch(url, {
|
||||
method: 'PUT',
|
||||
...config,
|
||||
headers: {
|
||||
@@ -152,7 +152,7 @@ class ExternalAPI {
|
||||
config?: RequestInit
|
||||
): Promise<T> {
|
||||
const url = this.formatUrl(endpoint, params);
|
||||
const response = await fetch(url.href, {
|
||||
const response = await fetch(url, {
|
||||
...config,
|
||||
headers: {
|
||||
...this.defaultHeaders,
|
||||
@@ -186,7 +186,7 @@ class ExternalAPI {
|
||||
Date.now() - DEFAULT_ROLLING_BUFFER
|
||||
) {
|
||||
const url = this.formatUrl(endpoint, params, overwriteBaseUrl);
|
||||
fetch(url.href, {
|
||||
fetch(url, {
|
||||
...config,
|
||||
headers: {
|
||||
...this.defaultHeaders,
|
||||
@@ -201,7 +201,7 @@ class ExternalAPI {
|
||||
}
|
||||
|
||||
const url = this.formatUrl(endpoint, params, overwriteBaseUrl);
|
||||
const response = await fetch(url.href, {
|
||||
const response = await fetch(url, {
|
||||
...config,
|
||||
headers: {
|
||||
...this.defaultHeaders,
|
||||
@@ -228,12 +228,10 @@ class ExternalAPI {
|
||||
(baseUrl.endsWith('/') ? '' : '/') +
|
||||
(endpoint.startsWith('/') ? endpoint.slice(1) : endpoint);
|
||||
const url = new URL(href);
|
||||
if (params) {
|
||||
url.search = new URLSearchParams({
|
||||
...this.params,
|
||||
...params,
|
||||
}).toString();
|
||||
}
|
||||
url.search = new URLSearchParams({
|
||||
...this.params,
|
||||
...params,
|
||||
}).toString();
|
||||
return url;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,8 +63,7 @@ class RottenTomatoes extends ExternalAPI {
|
||||
super(
|
||||
'https://79frdp12pn-dsn.algolia.net/1/indexes/*',
|
||||
{
|
||||
'x-algolia-agent':
|
||||
'Algolia%20for%20JavaScript%20(4.14.3)%3B%20Browser%20(lite)',
|
||||
'x-algolia-agent': 'Algolia for JavaScript (4.14.3); Browser (lite)',
|
||||
'x-algolia-api-key': '175588f6e5f8319b27702e4cc4013561',
|
||||
'x-algolia-application-id': '79FRDP12PN',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user