MCPcopy
hub / github.com/dvajs/dva / checkStatus

Function checkStatus

examples/user-dashboard/src/utils/request.js:3–11  ·  view source on GitHub ↗
(response)

Source from the content-addressed store, hash-verified

1import fetch from 'dva/fetch';
2
3function checkStatus(response) {
4 if (response.status >= 200 && response.status < 300) {
5 return response;
6 }
7
8 const error = new Error(response.statusText);
9 error.response = response;
10 throw error;
11}
12
13/**
14 * Requests a URL, returning a promise.

Callers 1

requestFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected