code-web: /builtin
This commit is contained in:
parent
53ec27a6c6
commit
973f5d00b4
|
@ -261,6 +261,9 @@ const requestHandler = (req, res) => {
|
|||
} else if (pathname === '/fetch-callback') {
|
||||
// callback fetch support
|
||||
return handleFetchCallback(req, res, parsedUrl);
|
||||
} else if (pathname === '/builtin') {
|
||||
// builtin extnesions JSON
|
||||
return handleBuiltInExtensions(req, res, parsedUrl);
|
||||
}
|
||||
|
||||
return serveError(req, res, 404, 'Not found.');
|
||||
|
@ -303,6 +306,17 @@ function addCORSReplyHeader(req) {
|
|||
return (ALLOWED_CORS_ORIGINS.indexOf(req.headers['origin']) >= 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('http').IncomingMessage} req
|
||||
* @param {import('http').ServerResponse} res
|
||||
* @param {import('url').UrlWithParsedQuery} parsedUrl
|
||||
*/
|
||||
async function handleBuiltInExtensions(req, res, parsedUrl) {
|
||||
const { extensions } = await builtInExtensionsPromise;
|
||||
res.writeHead(200, { 'Content-Type': 'application/json' });
|
||||
return res.end(JSON.stringify(extensions));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {import('http').IncomingMessage} req
|
||||
* @param {import('http').ServerResponse} res
|
||||
|
|
Loading…
Reference in a new issue