Skip to content

Commit abadac9

Browse files
authored
fix: Cannot pass useMasterKey: false to Parse.Cloud.run (#2431)
1 parent 360bc5f commit abadac9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Cloud.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export function run(name: string, data: any, options: RequestOptions): Promise<a
3737
}
3838

3939
const requestOptions: RequestOptions = {};
40-
if (options.useMasterKey) {
41-
requestOptions.useMasterKey = options.useMasterKey;
40+
if (options.hasOwnProperty('useMasterKey')) {
41+
requestOptions.useMasterKey = !!options.useMasterKey;
4242
}
4343
if (options.sessionToken) {
4444
requestOptions.sessionToken = options.sessionToken;

src/__tests__/Cloud-test.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ describe('Cloud', () => {
5555
it('run passes options', () => {
5656
Cloud.run('myfunction', {}, { useMasterKey: false });
5757

58-
expect(CoreManager.getCloudController().run.mock.calls[0]).toEqual(['myfunction', {}, {}]);
58+
expect(CoreManager.getCloudController().run.mock.calls[0]).toEqual([
59+
'myfunction',
60+
{},
61+
{ useMasterKey: false },
62+
]);
5963

6064
Cloud.run('myfunction', {}, { useMasterKey: true });
6165

0 commit comments

Comments
 (0)