MCPcopy Create free account
hub / github.com/COW-dev/ddingdong-fe / parseResponse

Function parseResponse

apps/web/app/_api/fetcher.ts:95–106  ·  view source on GitHub ↗
(
  response: ResponsePromise,
  type: 'json' | 'blob' = 'json',
)

Source from the content-addressed store, hash-verified

93});
94
95export async function parseResponse<T>(
96 response: ResponsePromise,
97 type: 'json' | 'blob' = 'json',
98): Promise<T> {
99 try {
100 if (type === 'blob') return (await response.blob()) as T;
101 return await response.json<T>();
102 } catch (error) {
103 Sentry.captureException(error);
104 throw error;
105 }
106}
107
108async function discardResponse(response: ResponsePromise): Promise<void> {
109 try {

Callers 1

fetcher.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected