Skip to content

Commit

Permalink
fix: Cannot pass useMasterKey: false to Parse.Cloud.run (#2431)
Browse files Browse the repository at this point in the history
  • Loading branch information
dplewis authored Feb 11, 2025
1 parent 360bc5f commit abadac9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export function run(name: string, data: any, options: RequestOptions): Promise<a
}

const requestOptions: RequestOptions = {};
if (options.useMasterKey) {
requestOptions.useMasterKey = options.useMasterKey;
if (options.hasOwnProperty('useMasterKey')) {
requestOptions.useMasterKey = !!options.useMasterKey;
}
if (options.sessionToken) {
requestOptions.sessionToken = options.sessionToken;
Expand Down
6 changes: 5 additions & 1 deletion src/__tests__/Cloud-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ describe('Cloud', () => {
it('run passes options', () => {
Cloud.run('myfunction', {}, { useMasterKey: false });

expect(CoreManager.getCloudController().run.mock.calls[0]).toEqual(['myfunction', {}, {}]);
expect(CoreManager.getCloudController().run.mock.calls[0]).toEqual([
'myfunction',
{},
{ useMasterKey: false },
]);

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

Expand Down

0 comments on commit abadac9

Please sign in to comment.