Skip to content

Commit fd7d062

Browse files
stainless-botRobertCraigie
authored andcommitted
chore(internal): remove unused isRequestOptions() function
chore: unknown commit message
1 parent 8367e3d commit fd7d062

File tree

1 file changed

+1
-32
lines changed

1 file changed

+1
-32
lines changed

src/internal/request-options.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
import { NullableHeaders } from './headers';
44

55
import type { BodyInit } from './builtin-types';
6-
import { isEmptyObj, hasOwn } from './utils/values';
76
import { Stream } from '../streaming';
8-
import type { HTTPMethod, KeysEnum, MergedRequestInit } from './types';
7+
import type { HTTPMethod, MergedRequestInit } from './types';
98
import { type HeadersLike } from './headers';
109

1110
export type FinalRequestOptions = RequestOptions & { method: HTTPMethod; path: string };
@@ -27,36 +26,6 @@ export type RequestOptions = {
2726
__streamClass?: typeof Stream;
2827
};
2928

30-
// This is required so that we can determine if a given object matches the RequestOptions
31-
// type at runtime. While this requires duplication, it is enforced by the TypeScript
32-
// compiler such that any missing / extraneous keys will cause an error.
33-
const requestOptionsKeys: KeysEnum<RequestOptions> = {
34-
method: true,
35-
path: true,
36-
query: true,
37-
body: true,
38-
headers: true,
39-
40-
maxRetries: true,
41-
stream: true,
42-
timeout: true,
43-
fetchOptions: true,
44-
signal: true,
45-
idempotencyKey: true,
46-
47-
__binaryResponse: true,
48-
__streamClass: true,
49-
};
50-
51-
export const isRequestOptions = (obj: unknown): obj is RequestOptions => {
52-
return (
53-
typeof obj === 'object' &&
54-
obj !== null &&
55-
!isEmptyObj(obj) &&
56-
Object.keys(obj).every((k) => hasOwn(requestOptionsKeys, k))
57-
);
58-
};
59-
6029
export type EncodedContent = { bodyHeaders: HeadersLike; body: BodyInit };
6130
export type RequestEncoder = (request: { headers: NullableHeaders; body: unknown }) => EncodedContent;
6231

0 commit comments

Comments
 (0)