change successfulFetch return type
This commit is contained in:
parent
2a61704a0d
commit
1bbbd4f389
2
dist/utils/net.util.cjs.map
vendored
2
dist/utils/net.util.cjs.map
vendored
File diff suppressed because one or more lines are too long
4
dist/utils/net.util.d.cts
vendored
4
dist/utils/net.util.d.cts
vendored
@ -1,4 +1,4 @@
|
|||||||
import fetch, { RequestInit, Response } from 'node-fetch';
|
import { RequestInit, Response } from 'node-fetch';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute fetch and verify that the response was successful.
|
* Execute fetch and verify that the response was successful.
|
||||||
@ -7,7 +7,7 @@ import fetch, { RequestInit, Response } from 'node-fetch';
|
|||||||
* @param options - Fetch options.
|
* @param options - Fetch options.
|
||||||
* @returns The fetch response.
|
* @returns The fetch response.
|
||||||
*/
|
*/
|
||||||
declare function successfulFetch(request: string, options?: RequestInit): Promise<fetch.Response>;
|
declare function successfulFetch(request: string, options?: RequestInit): Promise<any>;
|
||||||
/**
|
/**
|
||||||
* Execute fetch and return object response.
|
* Execute fetch and return object response.
|
||||||
*
|
*
|
||||||
|
4
dist/utils/net.util.d.ts
vendored
4
dist/utils/net.util.d.ts
vendored
@ -1,4 +1,4 @@
|
|||||||
import fetch, { RequestInit, Response } from 'node-fetch';
|
import { RequestInit, Response } from 'node-fetch';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute fetch and verify that the response was successful.
|
* Execute fetch and verify that the response was successful.
|
||||||
@ -7,7 +7,7 @@ import fetch, { RequestInit, Response } from 'node-fetch';
|
|||||||
* @param options - Fetch options.
|
* @param options - Fetch options.
|
||||||
* @returns The fetch response.
|
* @returns The fetch response.
|
||||||
*/
|
*/
|
||||||
declare function successfulFetch(request: string, options?: RequestInit): Promise<fetch.Response>;
|
declare function successfulFetch(request: string, options?: RequestInit): Promise<any>;
|
||||||
/**
|
/**
|
||||||
* Execute fetch and return object response.
|
* Execute fetch and return object response.
|
||||||
*
|
*
|
||||||
|
2
dist/utils/net.util.js.map
vendored
2
dist/utils/net.util.js.map
vendored
File diff suppressed because one or more lines are too long
@ -12,7 +12,7 @@ const hexRe = /^[0-9A-Fa-f]+$/gu
|
|||||||
* @param options - Fetch options.
|
* @param options - Fetch options.
|
||||||
* @returns The fetch response.
|
* @returns The fetch response.
|
||||||
*/
|
*/
|
||||||
export async function successfulFetch(request: string, options?: RequestInit) {
|
export async function successfulFetch(request: string, options?: RequestInit): Promise<any> {
|
||||||
const response = await fetch(request, options)
|
const response = await fetch(request, options)
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error(`Fetch failed with status '${response.status}' for request '${request}'`)
|
throw new Error(`Fetch failed with status '${response.status}' for request '${request}'`)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user