Skip to content

Commit ba29e7b

Browse files
jontiritilliJon Tiritilli
andauthored
refactor(Transport): specify AxiosRequestConfig type for request options for better type safety (#67)
style(Transport): simplify object return in prepareRequest by using concise arrow function syntax Co-authored-by: Jon Tiritilli <jon.tiritilli@domo.com>
1 parent 77248db commit ba29e7b

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/lib/Transport/index.ts

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export default class Transport {
3838
this.cookieJar = new CookieJar();
3939
}
4040

41-
request = (options: any): Promise<any> => this.clientPromise.then((client) => client.processRequestRaw(options));
41+
request = (options: AxiosRequestConfig): Promise<any> =>
42+
this.clientPromise.then((client) => client.processRequestRaw(options as any));
4243

4344
getEnv(instance: string): string {
4445
const regexp = /([-_\w]+)\.(.*)/;
@@ -163,15 +164,13 @@ export default class Transport {
163164
hostname = domain.url;
164165
return this.prepareHeaders(req.headers, this.proxyId, hostname);
165166
})
166-
.then((headers) => {
167-
return {
168-
jar: this.cookieJar,
169-
headers,
170-
url: api,
171-
responseType: 'stream' as const,
172-
method: req.method,
173-
};
174-
});
167+
.then((headers) => ({
168+
jar: this.cookieJar,
169+
headers,
170+
url: api,
171+
responseType: 'stream' as const,
172+
method: req.method,
173+
}));
175174
}
176175

177176
private prepareHeaders(headers: IncomingHttpHeaders, _context: string, host: string): Promise<IncomingHttpHeaders> {

0 commit comments

Comments
 (0)