You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that if any baseUrl option is passed to a client's coreFetch (GET/POST/...) call, the client's default baseUrl option gets overwritten for the rest of the requests. This leads to issues where the a url prefix change is necessary for some requests, but unnecessary for others.
Here is the diff that solved my problem:
diff --git a/node_modules/openapi-fetch/dist/index.js b/node_modules/openapi-fetch/dist/index.js
index 56c4826..e7d4bba 100644
--- a/node_modules/openapi-fetch/dist/index.js+++ b/node_modules/openapi-fetch/dist/index.js@@ -44,8 +44,9 @@ export default function createClient(clientOptions) {
body,
...init
} = fetchOptions || {};
+ let finalBaseUrl = baseUrl;
if (localBaseUrl) {
- baseUrl = removeTrailingSlash(localBaseUrl);+ finalBaseUrl = removeTrailingSlash(localBaseUrl) ?? baseUrl;
}
let querySerializer =
@@ -84,7 +85,7 @@ export default function createClient(clientOptions) {
let id;
let options;
- let request = new CustomRequest(createFinalURL(schemaPath, { baseUrl, params, querySerializer }), requestInit);+ let request = new CustomRequest(createFinalURL(schemaPath, { baseUrl: finalBaseUrl, params, querySerializer }), requestInit);
/** Add custom parameters to Request object */
for (const key in init) {
@@ -98,7 +99,7 @@ export default function createClient(clientOptions) {
// middleware (request)
options = Object.freeze({
- baseUrl,+ baseUrl: finalBaseUrl,
fetch,
parseAs,
querySerializer,
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
[email protected]
for the project I'm working on.The problem is that if any
baseUrl
option is passed to a client's coreFetch (GET/POST/...) call, the client's defaultbaseUrl
option gets overwritten for the rest of the requests. This leads to issues where the a url prefix change is necessary for some requests, but unnecessary for others.Here is the diff that solved my problem:
This issue body was partially generated by patch-package.
The text was updated successfully, but these errors were encountered: