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

Merge pull request #2480 from dracomithril/add_multiple_headers

add multiple headers in different type

authored by

Lubos and committed by
GitHub
64b786fa 091ca65f

+4116 -339
+5
.changeset/giant-dodos-lay.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + fix(client): call `auth()` function for every unique security `name`
+37
packages/custom-client/src/__tests__/utils.test.ts
··· 207 207 expect(headers.get('Cookie')).toBe('baz=foo'); 208 208 expect(query).toEqual({}); 209 209 }); 210 + 211 + it('sets only one specific header', async () => { 212 + const auth = vi.fn(({ name }: Auth) => { 213 + if (name === 'baz') { 214 + return 'foo'; 215 + } 216 + return 'buz'; 217 + }); 218 + const headers = new Headers(); 219 + const query: Record<any, unknown> = {}; 220 + await setAuthParams({ 221 + auth, 222 + headers, 223 + query, 224 + security: [ 225 + { 226 + name: 'baz', 227 + scheme: 'bearer', 228 + type: 'http', 229 + }, 230 + { 231 + name: 'fiz', 232 + type: 'http', 233 + }, 234 + { 235 + in: 'query', 236 + name: 'baz', 237 + scheme: 'bearer', 238 + type: 'http', 239 + }, 240 + ], 241 + }); 242 + expect(auth).toHaveBeenCalled(); 243 + expect(headers.get('baz')).toBe('Bearer foo'); 244 + expect(headers.get('fiz')).toBe('buz'); 245 + expect(Object.keys(query).length).toBe(0); 246 + }); 210 247 });
+23 -2
packages/custom-client/src/utils.ts
··· 186 186 return; 187 187 }; 188 188 189 + const checkForExistence = ( 190 + options: Pick<RequestOptions, 'auth' | 'query'> & { 191 + headers: Headers; 192 + }, 193 + name?: string, 194 + ): boolean => { 195 + if (!name) { 196 + return false; 197 + } 198 + if ( 199 + options.headers.has(name) || 200 + options.query?.[name] || 201 + options.headers.get('Cookie')?.includes(`${name}=`) 202 + ) { 203 + return true; 204 + } 205 + return false; 206 + }; 207 + 189 208 export const setAuthParams = async ({ 190 209 security, 191 210 ...options ··· 194 213 headers: Headers; 195 214 }) => { 196 215 for (const auth of security) { 216 + if (checkForExistence(options, auth.name)) { 217 + continue; 218 + } 219 + 197 220 const token = await getAuthToken(auth, options.auth); 198 221 199 222 if (!token) { ··· 217 240 options.headers.set(name, token); 218 241 break; 219 242 } 220 - 221 - return; 222 243 } 223 244 }; 224 245
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/body-response-text-plain/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/form-data/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/schema-unknown/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-api-key/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-basic/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/security-oauth2/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-base-path/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers-host/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/servers/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/2.0.x/transforms-read-write/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/body-response-text-plain/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/content-types/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/internal-name-conflict/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false-axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/parameter-explode-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/default/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-api-key/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-http-bearer/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-oauth2/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/security-open-id-connect/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/servers/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-all-of/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-any-of-null/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transformers-array/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/transforms-read-write/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/body-response-text-plain/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-false/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-number/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-strict/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/base-url-string/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/default/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-optional/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/sdk-client-required/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-axios/tsconfig-nodenext-sdk/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-number/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-strict/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/base-url-string/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/default/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-optional/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/sdk-client-required/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-fetch/tsconfig-nodenext-sdk/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-number/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-strict/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/base-url-string/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/default/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-optional/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/sdk-client-required/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-next/tsconfig-nodenext-sdk/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 199 221 const token = await getAuthToken(auth, options.auth); 200 222 201 223 if (!token) { ··· 219 241 options.headers.set(name, token); 220 242 break; 221 243 } 222 - 223 - return; 224 244 } 225 245 }; 226 246
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-false/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-number/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-strict/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/base-url-string/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/default/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-optional/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/sdk-client-required/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+22 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/@hey-api/client-nuxt/tsconfig-nodenext-sdk/client/utils.gen.ts
··· 148 148 return querySerializer; 149 149 }; 150 150 151 + const checkForExistence = ( 152 + options: Pick<RequestOptions, 'auth' | 'query'> & { 153 + headers: Headers; 154 + }, 155 + name?: string, 156 + ): boolean => { 157 + if (!name) { 158 + return false; 159 + } 160 + if ( 161 + options.headers.has(name) || 162 + toValue(options.query)?.[name] || 163 + options.headers.get('Cookie')?.includes(`${name}=`) 164 + ) { 165 + return true; 166 + } 167 + return false; 168 + }; 169 + 151 170 export const setAuthParams = async ({ 152 171 security, 153 172 ...options ··· 156 175 headers: Headers; 157 176 }) => { 158 177 for (const auth of security) { 178 + if (checkForExistence(options, auth.name)) { 179 + continue; 180 + } 159 181 const token = await getAuthToken(auth, options.auth); 160 182 161 183 if (!token) { ··· 179 201 options.headers.set(name, token); 180 202 break; 181 203 } 182 - 183 - return; 184 204 } 185 205 }; 186 206
+1 -1
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/clients/client-custom/bundle/client/index.cjs
··· 1 - 'use strict';var C=async(n,r)=>{let e=typeof r=="function"?await r(n):r;if(e)return n.scheme==="bearer"?`Bearer ${e}`:n.scheme==="basic"?`Basic ${btoa(e)}`:e};var w=(n,r,e)=>{typeof e=="string"||e instanceof Blob?n.append(r,e):n.append(r,JSON.stringify(e));},P=(n,r,e)=>{typeof e=="string"?n.append(r,e):n.append(r,JSON.stringify(e));},_={bodySerializer:n=>{let r=new FormData;return Object.entries(n).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>w(r,e,s)):w(r,e,o));}),r}},x={bodySerializer:n=>JSON.stringify(n,(r,e)=>typeof e=="bigint"?e.toString():e)},U={bodySerializer:n=>{let r=new URLSearchParams;return Object.entries(n).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>P(r,e,s)):P(r,e,o));}),r.toString()}};var D=n=>{switch(n){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},M=n=>{switch(n){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},F=n=>{switch(n){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},O=({allowReserved:n,explode:r,name:e,style:o,value:s})=>{if(!r){let t=(n?s:s.map(c=>encodeURIComponent(c))).join(M(o));switch(o){case "label":return `.${t}`;case "matrix":return `;${e}=${t}`;case "simple":return t;default:return `${e}=${t}`}}let a=D(o),i=s.map(t=>o==="label"||o==="simple"?n?t:encodeURIComponent(t):h({allowReserved:n,name:e,value:t})).join(a);return o==="label"||o==="matrix"?a+i:i},h=({allowReserved:n,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${n?e:encodeURIComponent(e)}`},R=({allowReserved:n,explode:r,name:e,style:o,value:s,valueOnly:a})=>{if(s instanceof Date)return a?s.toISOString():`${e}=${s.toISOString()}`;if(o!=="deepObject"&&!r){let c=[];Object.entries(s).forEach(([f,d])=>{c=[...c,f,n?d:encodeURIComponent(d)];});let p=c.join(",");switch(o){case "form":return `${e}=${p}`;case "label":return `.${p}`;case "matrix":return `;${e}=${p}`;default:return p}}let i=F(o),t=Object.entries(s).map(([c,p])=>h({allowReserved:n,name:o==="deepObject"?`${e}[${c}]`:c,value:p})).join(i);return o==="label"||o==="matrix"?i+t:t};var B=/\{[^{}]+\}/g,H=({path:n,url:r})=>{let e=r,o=r.match(B);if(o)for(let s of o){let a=false,i=s.substring(1,s.length-1),t="simple";i.endsWith("*")&&(a=true,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),t="label"):i.startsWith(";")&&(i=i.substring(1),t="matrix");let c=n[i];if(c==null)continue;if(Array.isArray(c)){e=e.replace(s,O({explode:a,name:i,style:t,value:c}));continue}if(typeof c=="object"){e=e.replace(s,R({explode:a,name:i,style:t,value:c,valueOnly:true}));continue}if(t==="matrix"){e=e.replace(s,`;${h({name:i,value:c})}`);continue}let p=encodeURIComponent(t==="label"?`.${c}`:c);e=e.replace(s,p);}return e},k=({allowReserved:n,array:r,object:e}={})=>s=>{let a=[];if(s&&typeof s=="object")for(let i in s){let t=s[i];if(t!=null)if(Array.isArray(t)){let c=O({allowReserved:n,explode:true,name:i,style:"form",value:t,...r});c&&a.push(c);}else if(typeof t=="object"){let c=R({allowReserved:n,explode:true,name:i,style:"deepObject",value:t,...e});c&&a.push(c);}else {let c=h({allowReserved:n,name:i,value:t});c&&a.push(c);}}return a.join("&")},I=n=>{if(!n)return "stream";let r=n.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},T=async({security:n,...r})=>{for(let e of n){let o=await C(e,r.auth);if(!o)continue;let s=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[s]=o;break;case "cookie":r.headers.append("Cookie",`${s}=${o}`);break;case "header":default:r.headers.set(s,o);break}return}},q=n=>W({baseUrl:n.baseUrl,path:n.path,query:n.query,querySerializer:typeof n.querySerializer=="function"?n.querySerializer:k(n.querySerializer),url:n.url}),W=({baseUrl:n,path:r,query:e,querySerializer:o,url:s})=>{let a=s.startsWith("/")?s:`/${s}`,i=(n??"")+a;r&&(i=H({path:r,url:i}));let t=e?o(e):"";return t.startsWith("?")&&(t=t.substring(1)),t&&(i+=`?${t}`),i},z=(n,r)=>{let e={...n,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=j(n.headers,r.headers),e},j=(...n)=>{let r=new Headers;for(let e of n){if(!e||typeof e!="object")continue;let o=e instanceof Headers?e.entries():Object.entries(e);for(let[s,a]of o)if(a===null)r.delete(s);else if(Array.isArray(a))for(let i of a)r.append(s,i);else a!==void 0&&r.set(s,typeof a=="object"?JSON.stringify(a):a);}return r},g=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}getInterceptorIndex(r){return typeof r=="number"?this._fns[r]?r:-1:this._fns.indexOf(r)}exists(r){let e=this.getInterceptorIndex(r);return !!this._fns[e]}eject(r){let e=this.getInterceptorIndex(r);this._fns[e]&&(this._fns[e]=null);}update(r,e){let o=this.getInterceptorIndex(r);return this._fns[o]?(this._fns[o]=e,r):false}use(r){return this._fns=[...this._fns,r],this._fns.length-1}},E=()=>({error:new g,request:new g,response:new g}),N=k({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),Q={"Content-Type":"application/json"},A=(n={})=>({...x,headers:Q,parseAs:"auto",querySerializer:N,...n});var V=(n={})=>{let r=z(A(),n),e=()=>({...r}),o=i=>(r=z(r,i),e()),s=E(),a=async i=>{let t={...r,...i,fetch:i.fetch??r.fetch??globalThis.fetch,headers:j(r.headers,i.headers)};t.security&&await T({...t,security:t.security}),t.requestValidator&&await t.requestValidator(t),t.body&&t.bodySerializer&&(t.body=t.bodySerializer(t.body)),(t.body===void 0||t.body==="")&&t.headers.delete("Content-Type");let c=q(t),p={redirect:"follow",...t},f=new Request(c,p);for(let u of s.request._fns)u&&(f=await u(f,t));let d=t.fetch,l=await d(f);for(let u of s.response._fns)u&&(l=await u(l,f,t));let b={request:f,response:l};if(l.ok){if(l.status===204||l.headers.get("Content-Length")==="0")return {data:{},...b};let u=(t.parseAs==="auto"?I(l.headers.get("Content-Type")):t.parseAs)??"json",m;switch(u){case "arrayBuffer":case "blob":case "formData":case "json":case "text":m=await l[u]();break;case "stream":return {data:l.body,...b}}return u==="json"&&(t.responseValidator&&await t.responseValidator(m),t.responseTransformer&&(m=await t.responseTransformer(m))),{data:m,...b}}let S=await l.text();try{S=JSON.parse(S);}catch{}let y=S;for(let u of s.error._fns)u&&(y=await u(S,l,f,t));if(y=y||{},t.throwOnError)throw y;return {error:y,...b}};return {buildUrl:q,connect:i=>a({...i,method:"CONNECT"}),delete:i=>a({...i,method:"DELETE"}),get:i=>a({...i,method:"GET"}),getConfig:e,head:i=>a({...i,method:"HEAD"}),interceptors:s,options:i=>a({...i,method:"OPTIONS"}),patch:i=>a({...i,method:"PATCH"}),post:i=>a({...i,method:"POST"}),put:i=>a({...i,method:"PUT"}),request:a,setConfig:o,trace:i=>a({...i,method:"TRACE"})}};var J={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},K=Object.entries(J),$=(n,r)=>{r||(r=new Map);for(let e of n)"in"in e?e.key&&r.set(e.key,{in:e.in,map:e.map}):e.args&&$(e.args,r);return r},L=n=>{for(let[r,e]of Object.entries(n))e&&typeof e=="object"&&!Object.keys(e).length&&delete n[r];},G=(n,r)=>{let e={body:{},headers:{},path:{},query:{}},o=$(r),s;for(let[a,i]of n.entries())if(r[a]&&(s=r[a]),!!s)if("in"in s)if(s.key){let t=o.get(s.key),c=t.map||s.key;e[t.in][c]=i;}else e.body=i;else for(let[t,c]of Object.entries(i??{})){let p=o.get(t);if(p){let f=p.map||t;e[p.in][f]=c;}else {let f=K.find(([d])=>t.startsWith(d));if(f){let[d,l]=f;e[l][t.slice(d.length)]=c;}else for(let[d,l]of Object.entries(s.allowExtra??{}))if(l){e[d][t]=c;break}}}return L(e),e};exports.buildClientParams=G;exports.createClient=V;exports.createConfig=A;exports.formDataBodySerializer=_;exports.jsonBodySerializer=x;exports.urlSearchParamsBodySerializer=U;//# sourceMappingURL=index.cjs.map 1 + 'use strict';var A=async(t,r)=>{let e=typeof r=="function"?await r(t):r;if(e)return t.scheme==="bearer"?`Bearer ${e}`:t.scheme==="basic"?`Basic ${btoa(e)}`:e};var w=(t,r,e)=>{typeof e=="string"||e instanceof Blob?t.append(r,e):t.append(r,JSON.stringify(e));},P=(t,r,e)=>{typeof e=="string"?t.append(r,e):t.append(r,JSON.stringify(e));},_={bodySerializer:t=>{let r=new FormData;return Object.entries(t).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>w(r,e,s)):w(r,e,o));}),r}},x={bodySerializer:t=>JSON.stringify(t,(r,e)=>typeof e=="bigint"?e.toString():e)},U={bodySerializer:t=>{let r=new URLSearchParams;return Object.entries(t).forEach(([e,o])=>{o!=null&&(Array.isArray(o)?o.forEach(s=>P(r,e,s)):P(r,e,o));}),r.toString()}};var D=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},F=t=>{switch(t){case "form":return ",";case "pipeDelimited":return "|";case "spaceDelimited":return "%20";default:return ","}},M=t=>{switch(t){case "label":return ".";case "matrix":return ";";case "simple":return ",";default:return "&"}},O=({allowReserved:t,explode:r,name:e,style:o,value:s})=>{if(!r){let n=(t?s:s.map(c=>encodeURIComponent(c))).join(F(o));switch(o){case "label":return `.${n}`;case "matrix":return `;${e}=${n}`;case "simple":return n;default:return `${e}=${n}`}}let a=D(o),i=s.map(n=>o==="label"||o==="simple"?t?n:encodeURIComponent(n):m({allowReserved:t,name:e,value:n})).join(a);return o==="label"||o==="matrix"?a+i:i},m=({allowReserved:t,name:r,value:e})=>{if(e==null)return "";if(typeof e=="object")throw new Error("Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these.");return `${r}=${t?e:encodeURIComponent(e)}`},R=({allowReserved:t,explode:r,name:e,style:o,value:s,valueOnly:a})=>{if(s instanceof Date)return a?s.toISOString():`${e}=${s.toISOString()}`;if(o!=="deepObject"&&!r){let c=[];Object.entries(s).forEach(([f,d])=>{c=[...c,f,t?d:encodeURIComponent(d)];});let p=c.join(",");switch(o){case "form":return `${e}=${p}`;case "label":return `.${p}`;case "matrix":return `;${e}=${p}`;default:return p}}let i=M(o),n=Object.entries(s).map(([c,p])=>m({allowReserved:t,name:o==="deepObject"?`${e}[${c}]`:c,value:p})).join(i);return o==="label"||o==="matrix"?i+n:n};var H=/\{[^{}]+\}/g,B=({path:t,url:r})=>{let e=r,o=r.match(H);if(o)for(let s of o){let a=false,i=s.substring(1,s.length-1),n="simple";i.endsWith("*")&&(a=true,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),n="label"):i.startsWith(";")&&(i=i.substring(1),n="matrix");let c=t[i];if(c==null)continue;if(Array.isArray(c)){e=e.replace(s,O({explode:a,name:i,style:n,value:c}));continue}if(typeof c=="object"){e=e.replace(s,R({explode:a,name:i,style:n,value:c,valueOnly:true}));continue}if(n==="matrix"){e=e.replace(s,`;${m({name:i,value:c})}`);continue}let p=encodeURIComponent(n==="label"?`.${c}`:c);e=e.replace(s,p);}return e},k=({allowReserved:t,array:r,object:e}={})=>s=>{let a=[];if(s&&typeof s=="object")for(let i in s){let n=s[i];if(n!=null)if(Array.isArray(n)){let c=O({allowReserved:t,explode:true,name:i,style:"form",value:n,...r});c&&a.push(c);}else if(typeof n=="object"){let c=R({allowReserved:t,explode:true,name:i,style:"deepObject",value:n,...e});c&&a.push(c);}else {let c=m({allowReserved:t,name:i,value:n});c&&a.push(c);}}return a.join("&")},I=t=>{if(!t)return "stream";let r=t.split(";")[0]?.trim();if(r){if(r.startsWith("application/json")||r.endsWith("+json"))return "json";if(r==="multipart/form-data")return "formData";if(["application/","audio/","image/","video/"].some(e=>r.startsWith(e)))return "blob";if(r.startsWith("text/"))return "text"}},W=(t,r)=>r?!!(t.headers.has(r)||t.query?.[r]||t.headers.get("Cookie")?.includes(`${r}=`)):false,T=async({security:t,...r})=>{for(let e of t){if(W(r,e.name))continue;let o=await A(e,r.auth);if(!o)continue;let s=e.name??"Authorization";switch(e.in){case "query":r.query||(r.query={}),r.query[s]=o;break;case "cookie":r.headers.append("Cookie",`${s}=${o}`);break;case "header":default:r.headers.set(s,o);break}}},q=t=>N({baseUrl:t.baseUrl,path:t.path,query:t.query,querySerializer:typeof t.querySerializer=="function"?t.querySerializer:k(t.querySerializer),url:t.url}),N=({baseUrl:t,path:r,query:e,querySerializer:o,url:s})=>{let a=s.startsWith("/")?s:`/${s}`,i=(t??"")+a;r&&(i=B({path:r,url:i}));let n=e?o(e):"";return n.startsWith("?")&&(n=n.substring(1)),n&&(i+=`?${n}`),i},z=(t,r)=>{let e={...t,...r};return e.baseUrl?.endsWith("/")&&(e.baseUrl=e.baseUrl.substring(0,e.baseUrl.length-1)),e.headers=C(t.headers,r.headers),e},C=(...t)=>{let r=new Headers;for(let e of t){if(!e||typeof e!="object")continue;let o=e instanceof Headers?e.entries():Object.entries(e);for(let[s,a]of o)if(a===null)r.delete(s);else if(Array.isArray(a))for(let i of a)r.append(s,i);else a!==void 0&&r.set(s,typeof a=="object"?JSON.stringify(a):a);}return r},g=class{_fns;constructor(){this._fns=[];}clear(){this._fns=[];}getInterceptorIndex(r){return typeof r=="number"?this._fns[r]?r:-1:this._fns.indexOf(r)}exists(r){let e=this.getInterceptorIndex(r);return !!this._fns[e]}eject(r){let e=this.getInterceptorIndex(r);this._fns[e]&&(this._fns[e]=null);}update(r,e){let o=this.getInterceptorIndex(r);return this._fns[o]?(this._fns[o]=e,r):false}use(r){return this._fns=[...this._fns,r],this._fns.length-1}},E=()=>({error:new g,request:new g,response:new g}),Q=k({allowReserved:false,array:{explode:true,style:"form"},object:{explode:true,style:"deepObject"}}),V={"Content-Type":"application/json"},j=(t={})=>({...x,headers:V,parseAs:"auto",querySerializer:Q,...t});var J=(t={})=>{let r=z(j(),t),e=()=>({...r}),o=i=>(r=z(r,i),e()),s=E(),a=async i=>{let n={...r,...i,fetch:i.fetch??r.fetch??globalThis.fetch,headers:C(r.headers,i.headers)};n.security&&await T({...n,security:n.security}),n.requestValidator&&await n.requestValidator(n),n.body&&n.bodySerializer&&(n.body=n.bodySerializer(n.body)),(n.body===void 0||n.body==="")&&n.headers.delete("Content-Type");let c=q(n),p={redirect:"follow",...n},f=new Request(c,p);for(let u of s.request._fns)u&&(f=await u(f,n));let d=n.fetch,l=await d(f);for(let u of s.response._fns)u&&(l=await u(l,f,n));let b={request:f,response:l};if(l.ok){if(l.status===204||l.headers.get("Content-Length")==="0")return {data:{},...b};let u=(n.parseAs==="auto"?I(l.headers.get("Content-Type")):n.parseAs)??"json",h;switch(u){case "arrayBuffer":case "blob":case "formData":case "json":case "text":h=await l[u]();break;case "stream":return {data:l.body,...b}}return u==="json"&&(n.responseValidator&&await n.responseValidator(h),n.responseTransformer&&(h=await n.responseTransformer(h))),{data:h,...b}}let S=await l.text();try{S=JSON.parse(S);}catch{}let y=S;for(let u of s.error._fns)u&&(y=await u(S,l,f,n));if(y=y||{},n.throwOnError)throw y;return {error:y,...b}};return {buildUrl:q,connect:i=>a({...i,method:"CONNECT"}),delete:i=>a({...i,method:"DELETE"}),get:i=>a({...i,method:"GET"}),getConfig:e,head:i=>a({...i,method:"HEAD"}),interceptors:s,options:i=>a({...i,method:"OPTIONS"}),patch:i=>a({...i,method:"PATCH"}),post:i=>a({...i,method:"POST"}),put:i=>a({...i,method:"PUT"}),request:a,setConfig:o,trace:i=>a({...i,method:"TRACE"})}};var K={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},L=Object.entries(K),$=(t,r)=>{r||(r=new Map);for(let e of t)"in"in e?e.key&&r.set(e.key,{in:e.in,map:e.map}):e.args&&$(e.args,r);return r},G=t=>{for(let[r,e]of Object.entries(t))e&&typeof e=="object"&&!Object.keys(e).length&&delete t[r];},v=(t,r)=>{let e={body:{},headers:{},path:{},query:{}},o=$(r),s;for(let[a,i]of t.entries())if(r[a]&&(s=r[a]),!!s)if("in"in s)if(s.key){let n=o.get(s.key),c=n.map||s.key;e[n.in][c]=i;}else e.body=i;else for(let[n,c]of Object.entries(i??{})){let p=o.get(n);if(p){let f=p.map||n;e[p.in][f]=c;}else {let f=L.find(([d])=>n.startsWith(d));if(f){let[d,l]=f;e[l][n.slice(d.length)]=c;}else for(let[d,l]of Object.entries(s.allowExtra??{}))if(l){e[d][n]=c;break}}}return G(e),e};exports.buildClientParams=v;exports.createClient=J;exports.createConfig=j;exports.formDataBodySerializer=_;exports.jsonBodySerializer=x;exports.urlSearchParamsBodySerializer=U;//# sourceMappingURL=index.cjs.map 2 2 //# sourceMappingURL=index.cjs.map
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/content-types/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/headers/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/internal-name-conflict/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/pagination-ref/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false-axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/parameter-explode-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes-instance/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/client-fetch/sdk-nested-classes/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/default/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/instance/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/sdk/throwOnError/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-valibot/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/transformers/type-format-zod/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-custom-name/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@hey-api/typescript/transforms-read-write-ignore/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/angular-query-experimental/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/react-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/solid-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/svelte-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/asClass/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+25 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/axios/client/utils.gen.ts
··· 140 140 return querySerializer; 141 141 }; 142 142 143 + const checkForExistence = ( 144 + options: Pick<RequestOptions, 'auth' | 'query'> & { 145 + headers: Record<any, unknown>; 146 + }, 147 + name?: string, 148 + ): boolean => { 149 + if (!name) { 150 + return false; 151 + } 152 + if (name in options.headers || options.query?.[name]) { 153 + return true; 154 + } 155 + if ( 156 + 'Cookie' in options.headers && 157 + options.headers['Cookie'] && 158 + typeof options.headers['Cookie'] === 'string' 159 + ) { 160 + return options.headers['Cookie'].includes(`${name}=`); 161 + } 162 + return false; 163 + }; 164 + 143 165 export const setAuthParams = async ({ 144 166 security, 145 167 ...options ··· 148 170 headers: Record<any, unknown>; 149 171 }) => { 150 172 for (const auth of security) { 173 + if (checkForExistence(options, auth.name)) { 174 + continue; 175 + } 151 176 const token = await getAuthToken(auth, options.auth); 152 177 153 178 if (!token) { ··· 177 202 options.headers[name] = token; 178 203 break; 179 204 } 180 - 181 - return; 182 205 } 183 206 }; 184 207
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/fetch/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/plugins/@tanstack/vue-query/name-builder/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-api-key/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-false/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-http-bearer/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-oauth2/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/security-open-id-connect/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/servers/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-all-of/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-any-of-null/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transformers-array/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/transforms-read-write/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/plugins/@tanstack/meta/client/utils.gen.ts
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+23 -2
packages/openapi-ts-tests/main/test/__snapshots__/test/generated/v3_no_index/client/utils.gen.ts.snap
··· 188 188 return; 189 189 }; 190 190 191 + const checkForExistence = ( 192 + options: Pick<RequestOptions, 'auth' | 'query'> & { 193 + headers: Headers; 194 + }, 195 + name?: string, 196 + ): boolean => { 197 + if (!name) { 198 + return false; 199 + } 200 + if ( 201 + options.headers.has(name) || 202 + options.query?.[name] || 203 + options.headers.get('Cookie')?.includes(`${name}=`) 204 + ) { 205 + return true; 206 + } 207 + return false; 208 + }; 209 + 191 210 export const setAuthParams = async ({ 192 211 security, 193 212 ...options ··· 196 215 headers: Headers; 197 216 }) => { 198 217 for (const auth of security) { 218 + if (checkForExistence(options, auth.name)) { 219 + continue; 220 + } 221 + 199 222 const token = await getAuthToken(auth, options.auth); 200 223 201 224 if (!token) { ··· 219 242 options.headers.set(name, token); 220 243 break; 221 244 } 222 - 223 - return; 224 245 } 225 246 }; 226 247
+37
packages/openapi-ts/src/plugins/@hey-api/client-axios/__tests__/utils.test.ts
··· 172 172 expect(headers.baz).toBeUndefined(); 173 173 expect(query.baz).toBe('Bearer foo'); 174 174 }); 175 + 176 + it('sets only one specific header', async () => { 177 + const auth = vi.fn(({ name }: Auth) => { 178 + if (name === 'baz') { 179 + return 'foo'; 180 + } 181 + return 'buz'; 182 + }); 183 + const headers: Record<any, unknown> = {}; 184 + const query: Record<any, unknown> = {}; 185 + await setAuthParams({ 186 + auth, 187 + headers, 188 + query, 189 + security: [ 190 + { 191 + name: 'baz', 192 + scheme: 'bearer', 193 + type: 'http', 194 + }, 195 + { 196 + name: 'fiz', 197 + type: 'http', 198 + }, 199 + { 200 + in: 'query', 201 + name: 'baz', 202 + scheme: 'bearer', 203 + type: 'http', 204 + }, 205 + ], 206 + }); 207 + expect(auth).toHaveBeenCalled(); 208 + expect(headers['baz']).toBe('Bearer foo'); 209 + expect(headers['fiz']).toBe('buz'); 210 + expect(Object.keys(query).length).toBe(0); 211 + }); 175 212 });
+25 -2
packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/utils.ts
··· 138 138 return querySerializer; 139 139 }; 140 140 141 + const checkForExistence = ( 142 + options: Pick<RequestOptions, 'auth' | 'query'> & { 143 + headers: Record<any, unknown>; 144 + }, 145 + name?: string, 146 + ): boolean => { 147 + if (!name) { 148 + return false; 149 + } 150 + if (name in options.headers || options.query?.[name]) { 151 + return true; 152 + } 153 + if ( 154 + 'Cookie' in options.headers && 155 + options.headers['Cookie'] && 156 + typeof options.headers['Cookie'] === 'string' 157 + ) { 158 + return options.headers['Cookie'].includes(`${name}=`); 159 + } 160 + return false; 161 + }; 162 + 141 163 export const setAuthParams = async ({ 142 164 security, 143 165 ...options ··· 146 168 headers: Record<any, unknown>; 147 169 }) => { 148 170 for (const auth of security) { 171 + if (checkForExistence(options, auth.name)) { 172 + continue; 173 + } 149 174 const token = await getAuthToken(auth, options.auth); 150 175 151 176 if (!token) { ··· 175 200 options.headers[name] = token; 176 201 break; 177 202 } 178 - 179 - return; 180 203 } 181 204 }; 182 205
+37
packages/openapi-ts/src/plugins/@hey-api/client-fetch/__tests__/utils.test.ts
··· 229 229 expect(headers.get('Cookie')).toBe('baz=foo'); 230 230 expect(query).toEqual({}); 231 231 }); 232 + 233 + it('sets only one specific header', async () => { 234 + const auth = vi.fn(({ name }: Auth) => { 235 + if (name === 'baz') { 236 + return 'foo'; 237 + } 238 + return 'buz'; 239 + }); 240 + const headers = new Headers(); 241 + const query: Record<any, unknown> = {}; 242 + await setAuthParams({ 243 + auth, 244 + headers, 245 + query, 246 + security: [ 247 + { 248 + name: 'baz', 249 + scheme: 'bearer', 250 + type: 'http', 251 + }, 252 + { 253 + name: 'fiz', 254 + type: 'http', 255 + }, 256 + { 257 + in: 'query', 258 + name: 'baz', 259 + scheme: 'bearer', 260 + type: 'http', 261 + }, 262 + ], 263 + }); 264 + expect(auth).toHaveBeenCalled(); 265 + expect(headers.get('baz')).toBe('Bearer foo'); 266 + expect(headers.get('fiz')).toBe('buz'); 267 + expect(Object.keys(query).length).toBe(0); 268 + }); 232 269 });
+23 -2
packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/utils.ts
··· 186 186 return; 187 187 }; 188 188 189 + const checkForExistence = ( 190 + options: Pick<RequestOptions, 'auth' | 'query'> & { 191 + headers: Headers; 192 + }, 193 + name?: string, 194 + ): boolean => { 195 + if (!name) { 196 + return false; 197 + } 198 + if ( 199 + options.headers.has(name) || 200 + options.query?.[name] || 201 + options.headers.get('Cookie')?.includes(`${name}=`) 202 + ) { 203 + return true; 204 + } 205 + return false; 206 + }; 207 + 189 208 export const setAuthParams = async ({ 190 209 security, 191 210 ...options ··· 194 213 headers: Headers; 195 214 }) => { 196 215 for (const auth of security) { 216 + if (checkForExistence(options, auth.name)) { 217 + continue; 218 + } 219 + 197 220 const token = await getAuthToken(auth, options.auth); 198 221 199 222 if (!token) { ··· 217 240 options.headers.set(name, token); 218 241 break; 219 242 } 220 - 221 - return; 222 243 } 223 244 }; 224 245
+37
packages/openapi-ts/src/plugins/@hey-api/client-next/__tests__/utils.test.ts
··· 207 207 expect(headers.get('Cookie')).toBe('baz=foo'); 208 208 expect(query).toEqual({}); 209 209 }); 210 + 211 + it('sets only one specific header', async () => { 212 + const auth = vi.fn(({ name }: Auth) => { 213 + if (name === 'baz') { 214 + return 'foo'; 215 + } 216 + return 'buz'; 217 + }); 218 + const headers = new Headers(); 219 + const query: Record<any, unknown> = {}; 220 + await setAuthParams({ 221 + auth, 222 + headers, 223 + query, 224 + security: [ 225 + { 226 + name: 'baz', 227 + scheme: 'bearer', 228 + type: 'http', 229 + }, 230 + { 231 + name: 'fiz', 232 + type: 'http', 233 + }, 234 + { 235 + in: 'query', 236 + name: 'baz', 237 + scheme: 'bearer', 238 + type: 'http', 239 + }, 240 + ], 241 + }); 242 + expect(auth).toHaveBeenCalled(); 243 + expect(headers.get('baz')).toBe('Bearer foo'); 244 + expect(headers.get('fiz')).toBe('buz'); 245 + expect(Object.keys(query).length).toBe(0); 246 + }); 210 247 });
+22 -2
packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/utils.ts
··· 186 186 return; 187 187 }; 188 188 189 + const checkForExistence = ( 190 + options: Pick<RequestOptions, 'auth' | 'query'> & { 191 + headers: Headers; 192 + }, 193 + name?: string, 194 + ): boolean => { 195 + if (!name) { 196 + return false; 197 + } 198 + if ( 199 + options.headers.has(name) || 200 + options.query?.[name] || 201 + options.headers.get('Cookie')?.includes(`${name}=`) 202 + ) { 203 + return true; 204 + } 205 + return false; 206 + }; 207 + 189 208 export const setAuthParams = async ({ 190 209 security, 191 210 ...options ··· 194 213 headers: Headers; 195 214 }) => { 196 215 for (const auth of security) { 216 + if (checkForExistence(options, auth.name)) { 217 + continue; 218 + } 197 219 const token = await getAuthToken(auth, options.auth); 198 220 199 221 if (!token) { ··· 217 239 options.headers.set(name, token); 218 240 break; 219 241 } 220 - 221 - return; 222 242 } 223 243 }; 224 244
+37
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/__tests__/utils.test.ts
··· 149 149 expect(headers.get('baz')).toBeNull(); 150 150 expect(query.baz).toBe('Bearer foo'); 151 151 }); 152 + 153 + it('sets only one specific header', async () => { 154 + const auth = vi.fn(({ name }: Auth) => { 155 + if (name === 'baz') { 156 + return 'foo'; 157 + } 158 + return 'buz'; 159 + }); 160 + const headers = new Headers(); 161 + const query: Record<any, unknown> = {}; 162 + await setAuthParams({ 163 + auth, 164 + headers, 165 + query, 166 + security: [ 167 + { 168 + name: 'baz', 169 + scheme: 'bearer', 170 + type: 'http', 171 + }, 172 + { 173 + name: 'fiz', 174 + type: 'http', 175 + }, 176 + { 177 + in: 'query', 178 + name: 'baz', 179 + scheme: 'bearer', 180 + type: 'http', 181 + }, 182 + ], 183 + }); 184 + expect(auth).toHaveBeenCalled(); 185 + expect(headers.get('baz')).toBe('Bearer foo'); 186 + expect(headers.get('fiz')).toBe('buz'); 187 + expect(Object.keys(query).length).toBe(0); 188 + }); 152 189 });
+22 -2
packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/utils.ts
··· 146 146 return querySerializer; 147 147 }; 148 148 149 + const checkForExistence = ( 150 + options: Pick<RequestOptions, 'auth' | 'query'> & { 151 + headers: Headers; 152 + }, 153 + name?: string, 154 + ): boolean => { 155 + if (!name) { 156 + return false; 157 + } 158 + if ( 159 + options.headers.has(name) || 160 + toValue(options.query)?.[name] || 161 + options.headers.get('Cookie')?.includes(`${name}=`) 162 + ) { 163 + return true; 164 + } 165 + return false; 166 + }; 167 + 149 168 export const setAuthParams = async ({ 150 169 security, 151 170 ...options ··· 154 173 headers: Headers; 155 174 }) => { 156 175 for (const auth of security) { 176 + if (checkForExistence(options, auth.name)) { 177 + continue; 178 + } 157 179 const token = await getAuthToken(auth, options.auth); 158 180 159 181 if (!token) { ··· 177 199 options.headers.set(name, token); 178 200 break; 179 201 } 180 - 181 - return; 182 202 } 183 203 }; 184 204