|
@@ -32,17 +32,18 @@ export const ReqHeaderMiddleware = (
|
|
|
}
|
|
|
|
|
|
const bypassURLs = [`/api/v1/milvus/connect`, `/api/v1/milvus/version`];
|
|
|
- const bypass = bypassURLs.indexOf(req.url) !== -1;
|
|
|
- const hasClient = clientCache.get(milvusClientId);
|
|
|
|
|
|
- if (!bypass && !hasClient) {
|
|
|
+ if (
|
|
|
+ bypassURLs.indexOf(req.url) === -1 &&
|
|
|
+ milvusClientId &&
|
|
|
+ !clientCache.get(milvusClientId)
|
|
|
+ ) {
|
|
|
throw HttpErrors(
|
|
|
HTTP_STATUS_CODE.UNAUTHORIZED,
|
|
|
'Can not find your connection, please reconnect.'
|
|
|
);
|
|
|
- } else {
|
|
|
- next();
|
|
|
}
|
|
|
+ next();
|
|
|
};
|
|
|
|
|
|
export const TransformResMiddleware = (
|