Repository: parse-community/Parse-SDK-JS
Pull request #1284 (2021-01-11 19:31:12)

Change default login method to POST
Closes: https://github.com/parse-community/Parse-SDK-JS/issues/1283

peril-parse-community[bot]: 
<!--
  0 failure: 
  0 warning: 
  
  1 markdown notices
  DangerID: danger-id-Peril;
-->



Danger run resulted in 1 warning; to find out more, see the [checks page](https://github.com/parse-community/Parse-SDK-JS/runs/1683549020).
<p align="right">
  Generated by :no_entry_sign: <a href="https://danger.systems/js">dangerJS</a>
</p>

codecov[bot]: # [Codecov](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=h1) Report
> Merging [#1284](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=desc) (05ac72b) into [master](https://codecov.io/gh/parse-community/Parse-SDK-JS/commit/a6bbd49be2284e9befcd9d52a8eeeda7e3a4e049?el=desc) (a6bbd49) will **not change** coverage.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284/graphs/tree.svg?width=650&height=150&src=pr&token=8nCENM0QHj)](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=tree)

```diff
@@            Coverage Diff            @@
##            master     #1284   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           58        58           
  Lines         5645      5645           
  Branches      1270      1270           
=========================================
  Hits          5645      5645           
```


| [Impacted Files](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [src/ParseUser.js](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284/diff?src=pr&el=tree#diff-c3JjL1BhcnNlVXNlci5qcw==) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=footer). Last update [a6bbd49...05ac72b](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1284?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/src/ParseUser.js b/src/ParseUser.js
index 65e6444..9ea7f14 100644
--- a/src/ParseUser.js
+++ b/src/ParseUser.js
@@ -436,7 +436,7 @@ class ParseUser extends ParseObject {
   logIn(options?: FullOptions): Promise<ParseUser> {
     options = options || {};
 
-    const loginOptions = {};
+    const loginOptions = { usePost: true };
     if (options.hasOwnProperty('useMasterKey')) {
       loginOptions.useMasterKey = options.useMasterKey;
     }


Test patch:
diff --git a/src/__tests__/ParseUser-test.js b/src/__tests__/ParseUser-test.js
index e081ecb..1e85375 100644
--- a/src/__tests__/ParseUser-test.js
+++ b/src/__tests__/ParseUser-test.js
@@ -223,7 +223,7 @@ describe('ParseUser', () => {
     ParseUser._clearCache();
     CoreManager.setRESTController({
       request(method, path, body) {
-        expect(method).toBe('GET');
+        expect(method).toBe('POST');
         expect(path).toBe('login');
         expect(body.username).toBe('username');
         expect(body.password).toBe('password');
@@ -259,7 +259,7 @@ describe('ParseUser', () => {
     ParseUser._clearCache();
     CoreManager.setRESTController({
       request(method, path, body, options) {
-        expect(method).toBe('GET');
+        expect(method).toBe('POST');
         expect(path).toBe('login');
         expect(body.username).toBe('username');
         expect(body.password).toBe('password');
@@ -288,7 +288,7 @@ describe('ParseUser', () => {
     ParseUser._clearCache();
     CoreManager.setRESTController({
       request(method, path, body) {
-        expect(method).toBe('POST');
+        expect(method).toBe('GET');
         expect(path).toBe('login');
         expect(body.username).toBe('username');
         expect(body.password).toBe('password');
@@ -304,7 +304,7 @@ describe('ParseUser', () => {
       },
       ajax() {},
     });
-    ParseUser.logIn('username', 'password', { usePost: true }).then(u => {
+    ParseUser.logIn('username', 'password', { usePost: false }).then(u => {
       expect(u.id).toBe('uid2');
       expect(u.getSessionToken()).toBe('123abc');
       expect(u.isCurrent()).toBe(true);
@@ -342,7 +342,7 @@ describe('ParseUser', () => {
     ParseUser._clearCache();
     CoreManager.setRESTController({
       request(method, path, body) {
-        expect(method).toBe('GET');
+        expect(method).toBe('POST');
         expect(path).toBe('login');
         expect(body.username).toBe('username');
         expect(body.password).toBe('password');
@@ -1469,7 +1469,7 @@ describe('ParseUser', () => {
     let u = null;
     CoreManager.setRESTController({
       request(method, path, body) {
-        expect(method).toBe('GET');
+        expect(method).toBe('POST');
         expect(path).toBe('login');
         expect(body.username).toBe('username');
         expect(body.password).toBe('password');
@@ -1524,7 +1524,7 @@ describe('ParseUser', () => {
     let u = null;
     CoreManager.setRESTController({
       request(method, path, body) {
-        expect(method).toBe('GET');
+        expect(method).toBe('POST');
         expect(path).toBe('login');
         expect(body.username).toBe('username');
         expect(body.password).toBe('password');