Skip to content

Commit dbad989

Browse files
authored
fix: prioritize options.useMasterKey over AV._useMasterKey (#370)
1 parent 10fa73c commit dbad989

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/request.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,13 @@ const setHeaders = (authOptions = {}) => {
105105
'X-LC-Id': AV.applicationId,
106106
'Content-Type': 'application/json;charset=UTF-8',
107107
};
108-
if (AV._useMasterKey || authOptions.useMasterKey) {
108+
let useMasterKey = false;
109+
if (typeof authOptions.useMasterKey === 'boolean') {
110+
useMasterKey = authOptions.useMasterKey;
111+
} else if (typeof AV._useMasterKey === 'boolean') {
112+
useMasterKey = AV._useMasterKey;
113+
}
114+
if (useMasterKey) {
109115
if (AV.masterKey) {
110116
headers['X-LC-Sign'] = sign(AV.masterKey, true);
111117
} else {

0 commit comments

Comments
 (0)