fix: Add null check for collection root in snippet generator

This commit is contained in:
Yash
2025-07-03 16:20:08 +05:30
committed by Maintainer Bruno
parent 1a93eabf01
commit 81877fa96a

View File

@@ -27,7 +27,8 @@ const generateSnippet = ({ language, item, collection, shouldInterpolate = false
// Add auth headers if needed
if (request.auth && request.auth.mode !== 'none') {
const authHeaders = getAuthHeaders(collection.root.request.auth, request.auth);
const collectionAuth = collection?.root?.request?.auth || null;
const authHeaders = getAuthHeaders(collectionAuth, request.auth);
headers = [...headers, ...authHeaders];
}