refactor widget api design
this passes all widget API calls through the backend, with a pluggable design and reusable API handlers
This commit is contained in:
1 parent
975f79f6cc
commit
97bf174b78
27 files changed
+370
-252
No files matched your search
@@ -44,3 +44,20 @@ export function httpRequest(url, params) {
|
||||
request.end();
|
||||
});
|
||||
}
|
||||
|
||||
export function httpProxy(url, params = {}) {
|
||||
const constructedUrl = new URL(url);
|
||||
|
||||
if (constructedUrl.protocol === "https:") {
|
||||
const httpsAgent = new https.Agent({
|
||||
rejectUnauthorized: false,
|
||||
});
|
||||
|
||||
return httpsRequest(constructedUrl, {
|
||||
agent: httpsAgent,
|
||||
...params,
|
||||
});
|
||||
} else {
|
||||
return httpRequest(constructedUrl, params);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user