Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(type): The parameter types for the 'get', 'post', and 'put' metho… #435

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,17 +643,17 @@ export declare namespace httpc {
middlewares?: middleware.Middleware[];
}

interface GetOptions<T = any> extends ReqOpts<T> {
interface GetOptions<T = any> extends Omit<ReqOpts<T>, 'urllibOptions'> {
params: Record<string, string>;
headers: Record<string, string>;
}

interface PostOptions<T = any> extends ReqOpts<T> {
interface PostOptions<T = any> extends Omit<ReqOpts<T>, 'urllibOptions'> {
data: string | Buffer | Readable;
headers: Record<string, string>;
}

interface PutOptions<T = any> extends ReqOpts<T> {
interface PutOptions<T = any> extends Omit<ReqOpts<T>, 'urllibOptions'> {
data: string | Buffer | Readable;
headers: Record<string, string>
}
Expand All @@ -664,9 +664,9 @@ export declare namespace httpc {
middlewares: middleware.Middleware[];
constructor(options: HttpClientOptions)
sendRequest(requestOptions: ReqOpts): Promise<ResponseWrapper>
get(getOptions: GetOptions): Promise<ResponseWrapper>
post(postOptions: PostOptions): Promise<ResponseWrapper>
put(putOptions: PutOptions): Promise<ResponseWrapper>
get(getOptions: GetOptions, urllibOptions?: RequestOptions): Promise<ResponseWrapper>
post(postOptions: PostOptions, urllibOptions?: RequestOptions): Promise<ResponseWrapper>
put(putOptions: PutOptions, urllibOptions?: RequestOptions): Promise<ResponseWrapper>
}

// endpoint.js
Expand Down