refactor: update json return type to JSON and format function parameters
This commit is contained in:
parent
6fad46fd95
commit
08b74ec61b
@ -7,7 +7,7 @@ type ResponseData = {
|
||||
body: http.IncomingMessage;
|
||||
headers: http.IncomingHttpHeaders;
|
||||
text: () => Promise<string>;
|
||||
json: () => Promise<any>;
|
||||
json: () => Promise<JSON>;
|
||||
buffer: () => Promise<Buffer>;
|
||||
arrayBuffer: () => Promise<ArrayBuffer>;
|
||||
};
|
||||
@ -43,7 +43,10 @@ const readData = (
|
||||
.on("error", reject);
|
||||
});
|
||||
|
||||
export default async (urlString: string, options: ExtendedRequestOptions = {}): Promise<ResponseData> => {
|
||||
export default async (
|
||||
urlString: string,
|
||||
options: ExtendedRequestOptions = {}
|
||||
): Promise<ResponseData> => {
|
||||
const { protocol, hostname, pathname, search, port } = new URL(urlString);
|
||||
|
||||
const body =
|
||||
|
Loading…
x
Reference in New Issue
Block a user