fix: returning resp.json()
because 204 status responses do not have a json payload Signed-off-by: Kurt King <kurtaking@gmail.com>
This commit is contained in:
@@ -73,11 +73,12 @@ export class CatalogUnprocessedEntitiesClient
|
||||
private async fetch<T>(path: string, init?: RequestInit): Promise<T> {
|
||||
const url = await this.discovery.getBaseUrl('catalog');
|
||||
const resp = await this.fetchApi.fetch(`${url}/${path}`, init);
|
||||
|
||||
if (!resp.ok) {
|
||||
throw await ResponseError.fromResponse(resp);
|
||||
}
|
||||
|
||||
return await resp.json();
|
||||
return resp.status === 204 ? (resp as T) : await resp.json();
|
||||
}
|
||||
|
||||
async pending(): Promise<CatalogUnprocessedEntitiesApiResponse> {
|
||||
|
||||
Reference in New Issue
Block a user