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

Function request

examples/user-dashboard/src/utils/request.js:20–37  ·  view source on GitHub ↗

* Requests a URL, returning a promise. * * @param {string} url The URL we want to request * @param {object} [options] The options we want to pass to "fetch" * @return {object} An object containing either "data" or "err"

(url, options)

Source from the content-addressed store, hash-verified

18 * @return {object} An object containing either "data" or "err"
19 */
20async function request(url, options) {
21 const response = await fetch(url, options);
22
23 checkStatus(response);
24
25 const data = await response.json();
26
27 const ret = {
28 data,
29 headers: {},
30 };
31
32 if (response.headers.get('x-total-count')) {
33 ret.headers['x-total-count'] = response.headers.get('x-total-count');
34 }
35
36 return ret;
37}
38
39export default request;

Callers 4

fetchFunction · 0.50
removeFunction · 0.50
patchFunction · 0.50
createFunction · 0.50

Calls 3

getMethod · 0.80
checkStatusFunction · 0.70
fetchFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…