MCPcopy Index your code
hub / github.com/FeatureProbe/FeatureProbe / request

Function request

ui/src/utils/request.ts:43–68  ·  view source on GitHub ↗
(url: string, options?: RequestInit)

Source from the content-addressed store, hash-verified

41}
42
43export default function request<T>(url: string, options?: RequestInit): Promise<IResponse<T>> {
44 options = options || {
45 headers:{
46 'Accept-Language': 'en-US'
47 }
48 };
49
50 return new Promise(resolve => {
51 return fetch(url, options)
52 .then(response => checkStatus(response))
53 .then(response => parseJSON(response))
54 .then(response => {
55 handleCode<IResponse<T>, T>(response, resolve);
56 resolve({
57 success: true,
58 data: response,
59 });
60 })
61 .catch(err => {
62 resolve({
63 success: false,
64 message: err.message,
65 });
66 });
67 });
68}

Callers 15

getToggleListFunction · 0.85
getToggleInfoFunction · 0.85
getTargetingFunction · 0.85
saveToggleFunction · 0.85
approveToggleFunction · 0.85
createToggleFunction · 0.85
editToggleFunction · 0.85
offlineToggleFunction · 0.85
restoreToggleFunction · 0.85
getTagsFunction · 0.85
addTagFunction · 0.85
getTrafficFunction · 0.85

Calls 3

checkStatusFunction · 0.85
parseJSONFunction · 0.85
handleCodeFunction · 0.85

Tested by

no test coverage detected