Merge pull request #5030 from stupidly-logical/fix/gen_code_auth_header

fix: Add null check for collection root in snippet generator #5029
This commit is contained in:
lohit
2025-07-03 19:28:10 +05:30
committed by Bijin A B
parent bbfa2b39a0
commit b3a99a4d85

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];
}