mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 17:29:44 +00:00
feat: specify the api's auth type (#2715)
This commit is contained in:
@@ -213,7 +213,10 @@ function getMethod(api: ApiType): 'GET' | 'POST' {
|
||||
|
||||
export function parseAPI({ path, rootPath }: { path: string; rootPath: string }): ApiType {
|
||||
const code = fs.readFileSync(path, 'utf-8');
|
||||
const authApiKey = code.includes('authApiKey: true');
|
||||
const authToken = code.includes('authToken: true');
|
||||
const api = parseCode(code);
|
||||
api.authorization = authApiKey ? 'apikey' : authToken ? 'token' : undefined;
|
||||
api.url = path.replace('.ts', '').replace(rootPath, '');
|
||||
api.path = path;
|
||||
if (api.method === undefined) {
|
||||
|
Reference in New Issue
Block a user