Skip to content

Commit ac14578

Browse files
authored
fix(query): remove unused getHttpFunctionQueryProps (#3626)
1 parent 93833b1 commit ac14578

2 files changed

Lines changed: 0 additions & 122 deletions

File tree

packages/query/src/client.test.ts

Lines changed: 0 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { describe, expect, it } from 'vitest';
44
import {
55
generateRequestOptionsArguments,
66
getHookOptions,
7-
getHttpFunctionQueryProps,
87
getQueryArgumentsRequestType,
98
getQueryHeader,
109
getQueryOptions,
@@ -118,102 +117,6 @@ describe('getQueryHeader', () => {
118117
});
119118
});
120119

121-
describe('getHttpFunctionQueryProps', () => {
122-
describe('without mutator (native Angular)', () => {
123-
it('should prefix with http for Angular httpClient', () => {
124-
const result = getHttpFunctionQueryProps(
125-
false,
126-
OutputHttpClient.ANGULAR,
127-
'params',
128-
true,
129-
false,
130-
);
131-
expect(result).toBe('http, params');
132-
});
133-
134-
it('should return just http when no query properties for Angular', () => {
135-
const result = getHttpFunctionQueryProps(
136-
false,
137-
OutputHttpClient.ANGULAR,
138-
'',
139-
true,
140-
false,
141-
);
142-
expect(result).toBe('http');
143-
});
144-
145-
it('should prefix with http when isAngular is true', () => {
146-
const result = getHttpFunctionQueryProps(
147-
false,
148-
OutputHttpClient.AXIOS,
149-
'params',
150-
true,
151-
false,
152-
);
153-
expect(result).toBe('http, params');
154-
});
155-
});
156-
157-
describe('with mutator (custom Angular mutator)', () => {
158-
it('should NOT prefix with http when mutator is used', () => {
159-
const result = getHttpFunctionQueryProps(
160-
false,
161-
OutputHttpClient.ANGULAR,
162-
'params',
163-
true,
164-
true,
165-
);
166-
expect(result).toBe('params');
167-
});
168-
169-
it('should return empty string when no query properties and mutator is used', () => {
170-
const result = getHttpFunctionQueryProps(
171-
false,
172-
OutputHttpClient.ANGULAR,
173-
'',
174-
true,
175-
true,
176-
);
177-
expect(result).toBe('');
178-
});
179-
180-
it('should NOT prefix with http even when isAngular is true if mutator is used', () => {
181-
const result = getHttpFunctionQueryProps(
182-
false,
183-
OutputHttpClient.AXIOS,
184-
'params',
185-
true,
186-
true,
187-
);
188-
expect(result).toBe('params');
189-
});
190-
});
191-
192-
describe('non-Angular clients', () => {
193-
it('should return query properties without http prefix for axios', () => {
194-
const result = getHttpFunctionQueryProps(
195-
false,
196-
OutputHttpClient.AXIOS,
197-
'params',
198-
false,
199-
false,
200-
);
201-
expect(result).toBe('params');
202-
});
203-
204-
it('should return query properties without http prefix for fetch', () => {
205-
const result = getHttpFunctionQueryProps(
206-
false,
207-
OutputHttpClient.FETCH,
208-
'params',
209-
false,
210-
false,
211-
);
212-
expect(result).toBe('params');
213-
});
214-
});
215-
});
216-
217120
describe('getQueryOptions', () => {
218121
const mockMutator = {
219122
name: 'customInstance',

packages/query/src/client.ts

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -751,31 +751,6 @@ export const getMutationRequestArgs = (
751751
: '';
752752
};
753753

754-
export const getHttpFunctionQueryProps = (
755-
isVue: boolean,
756-
httpClient: OutputHttpClient,
757-
queryProperties: string,
758-
isAngular = false,
759-
hasMutator = false,
760-
) => {
761-
const result =
762-
isVue && httpClient === OutputHttpClient.FETCH && queryProperties
763-
? queryProperties
764-
.split(',')
765-
.map((prop) => `unref(${prop})`)
766-
.join(',')
767-
: queryProperties;
768-
769-
// For Angular, prefix with http since request functions take HttpClient as first param
770-
// Skip when custom mutator is used - mutator handles HTTP client internally
771-
// http is required as first param so no assertion needed
772-
if ((isAngular || httpClient === OutputHttpClient.ANGULAR) && !hasMutator) {
773-
return result ? `http, ${result}` : 'http';
774-
}
775-
776-
return result;
777-
};
778-
779754
export const getQueryHeader: ClientHeaderBuilder = (params) => {
780755
if (params.output.httpClient === OutputHttpClient.FETCH) {
781756
return generateFetchHeader(params);

0 commit comments

Comments
 (0)