mirror of
https://github.com/usebruno/bruno.git
synced 2026-07-09 06:55:03 +00:00
Merge pull request #4752 from Art051/bugfix/4749-generate-code-error-with-binary-file-request
Bugfix/4749 generate code error with binary file request
This commit is contained in:
@@ -1,6 +1,15 @@
|
||||
import get from 'lodash/get';
|
||||
|
||||
export const getAuthHeaders = (collectionRootAuth, requestAuth) => {
|
||||
|
||||
// Discovered edge case where code generation fails when you create a collection which has not been saved yet:
|
||||
// Collection auth therefore null, and request inherits from collection, therefore it is also null
|
||||
// TypeError: Cannot read properties of undefined (reading 'mode')
|
||||
// at getAuthHeaders
|
||||
if (!collectionRootAuth && !requestAuth) {
|
||||
return [];
|
||||
}
|
||||
|
||||
const auth = collectionRootAuth && ['inherit'].includes(requestAuth?.mode) ? collectionRootAuth : requestAuth;
|
||||
|
||||
switch (auth.mode) {
|
||||
|
||||
Reference in New Issue
Block a user