fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge pull request #1424 from hey-api/fix/client-instance

fix: store client instance in a variable

authored by

Lubos and committed by
GitHub
655db0da 1f39b731

+31 -6
+5
.changeset/blue-chicken-allow.md
··· 1 + --- 2 + '@hey-api/client-axios': patch 3 + --- 4 + 5 + fix: assign axios to variable before sending requests
+5
.changeset/gorgeous-dryers-yawn.md
··· 1 + --- 2 + '@hey-api/client-fetch': patch 3 + --- 4 + 5 + fix: assign fetch to variable before sending requests
+3 -1
packages/client-axios/src/index.ts
··· 51 51 const url = buildUrl(opts); 52 52 53 53 try { 54 - const response = await opts.axios({ 54 + // assign Axios here for consistency with fetch 55 + const _axios = opts.axios; 56 + const response = await _axios({ 55 57 ...opts, 56 58 data: opts.body, 57 59 headers: opts.headers as RawAxiosRequestHeaders,
+4 -1
packages/client-fetch/src/index.ts
··· 68 68 request = await fn(request, opts); 69 69 } 70 70 71 - let response = await opts.fetch(request); 71 + // fetch must be assigned here, otherwise it would throw the error: 72 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 73 + const _fetch = opts.fetch!; 74 + let response = await _fetch(request); 72 75 73 76 for (const fn of interceptors.response._fns) { 74 77 response = await fn(response, request, opts);
+3 -1
packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle/client/index.ts.snap
··· 51 51 const url = buildUrl(opts); 52 52 53 53 try { 54 - const response = await opts.axios({ 54 + // assign Axios here for consistency with fetch 55 + const _axios = opts.axios; 56 + const response = await _axios({ 55 57 ...opts, 56 58 data: opts.body, 57 59 headers: opts.headers as RawAxiosRequestHeaders,
+3 -1
packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-axios-bundle_transform/client/index.ts.snap
··· 51 51 const url = buildUrl(opts); 52 52 53 53 try { 54 - const response = await opts.axios({ 54 + // assign Axios here for consistency with fetch 55 + const _axios = opts.axios; 56 + const response = await _axios({ 55 57 ...opts, 56 58 data: opts.body, 57 59 headers: opts.headers as RawAxiosRequestHeaders,
+4 -1
packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle/client/index.ts.snap
··· 68 68 request = await fn(request, opts); 69 69 } 70 70 71 - let response = await opts.fetch(request); 71 + // fetch must be assigned here, otherwise it would throw the error: 72 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 73 + const _fetch = opts.fetch!; 74 + let response = await _fetch(request); 72 75 73 76 for (const fn of interceptors.response._fns) { 74 77 response = await fn(response, request, opts);
+4 -1
packages/openapi-ts/test/__snapshots__/test/generated/v3-hey-api-client-fetch-bundle_transform/client/index.ts.snap
··· 68 68 request = await fn(request, opts); 69 69 } 70 70 71 - let response = await opts.fetch(request); 71 + // fetch must be assigned here, otherwise it would throw the error: 72 + // TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation 73 + const _fetch = opts.fetch!; 74 + let response = await _fetch(request); 72 75 73 76 for (const fn of interceptors.response._fns) { 74 77 response = await fn(response, request, opts);