Skip to content

Commit 38465cc

Browse files
authored
Change default login method to POST (#1284)
Closes: #1283
1 parent a6bbd49 commit 38465cc

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/ParseUser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ class ParseUser extends ParseObject {
436436
logIn(options?: FullOptions): Promise<ParseUser> {
437437
options = options || {};
438438

439-
const loginOptions = {};
439+
const loginOptions = { usePost: true };
440440
if (options.hasOwnProperty('useMasterKey')) {
441441
loginOptions.useMasterKey = options.useMasterKey;
442442
}

src/__tests__/ParseUser-test.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ describe('ParseUser', () => {
223223
ParseUser._clearCache();
224224
CoreManager.setRESTController({
225225
request(method, path, body) {
226-
expect(method).toBe('GET');
226+
expect(method).toBe('POST');
227227
expect(path).toBe('login');
228228
expect(body.username).toBe('username');
229229
expect(body.password).toBe('password');
@@ -259,7 +259,7 @@ describe('ParseUser', () => {
259259
ParseUser._clearCache();
260260
CoreManager.setRESTController({
261261
request(method, path, body, options) {
262-
expect(method).toBe('GET');
262+
expect(method).toBe('POST');
263263
expect(path).toBe('login');
264264
expect(body.username).toBe('username');
265265
expect(body.password).toBe('password');
@@ -288,7 +288,7 @@ describe('ParseUser', () => {
288288
ParseUser._clearCache();
289289
CoreManager.setRESTController({
290290
request(method, path, body) {
291-
expect(method).toBe('POST');
291+
expect(method).toBe('GET');
292292
expect(path).toBe('login');
293293
expect(body.username).toBe('username');
294294
expect(body.password).toBe('password');
@@ -304,7 +304,7 @@ describe('ParseUser', () => {
304304
},
305305
ajax() {},
306306
});
307-
ParseUser.logIn('username', 'password', { usePost: true }).then(u => {
307+
ParseUser.logIn('username', 'password', { usePost: false }).then(u => {
308308
expect(u.id).toBe('uid2');
309309
expect(u.getSessionToken()).toBe('123abc');
310310
expect(u.isCurrent()).toBe(true);
@@ -342,7 +342,7 @@ describe('ParseUser', () => {
342342
ParseUser._clearCache();
343343
CoreManager.setRESTController({
344344
request(method, path, body) {
345-
expect(method).toBe('GET');
345+
expect(method).toBe('POST');
346346
expect(path).toBe('login');
347347
expect(body.username).toBe('username');
348348
expect(body.password).toBe('password');
@@ -1469,7 +1469,7 @@ describe('ParseUser', () => {
14691469
let u = null;
14701470
CoreManager.setRESTController({
14711471
request(method, path, body) {
1472-
expect(method).toBe('GET');
1472+
expect(method).toBe('POST');
14731473
expect(path).toBe('login');
14741474
expect(body.username).toBe('username');
14751475
expect(body.password).toBe('password');
@@ -1524,7 +1524,7 @@ describe('ParseUser', () => {
15241524
let u = null;
15251525
CoreManager.setRESTController({
15261526
request(method, path, body) {
1527-
expect(method).toBe('GET');
1527+
expect(method).toBe('POST');
15281528
expect(path).toBe('login');
15291529
expect(body.username).toBe('username');
15301530
expect(body.password).toBe('password');

0 commit comments

Comments
 (0)