Skip to content

Commit 6402b56

Browse files
authored
Corect default method
Using Google bigquery I found that your code was comparing the result of `typeof` with a variable named `undefined`. As typeof returns a string it would compare to a string with the content `'undefined'` As I could see you just want to have a default value of `method` i simply replaced the code with a shorter/better version...
1 parent 0b83823 commit 6402b56

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/gmail.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,7 +1469,7 @@ var Gmail_ = function(localJQuery) {
14691469

14701470
api.tools.make_request = function (link, method) {
14711471
link = decodeURIComponent(link);
1472-
method = (typeof method == undefined || typeof method == null) ? 'GET' : method;
1472+
method = method || 'GET';
14731473

14741474
var request = $.ajax({ type: method, url: encodeURI(link), async:false });
14751475

@@ -1479,7 +1479,7 @@ var Gmail_ = function(localJQuery) {
14791479

14801480
api.tools.make_request_async = function (link, method, callback) {
14811481
link = decodeURIComponent(link);
1482-
method = (typeof method == undefined || typeof method == null) ? 'GET' : method;
1482+
method = method || 'GET';
14831483

14841484
$.ajax({ type: method, url: encodeURI(link), async:true, dataType: 'text' })
14851485
.done(function(data, textStatus, jqxhr) {
@@ -2584,3 +2584,4 @@ function initalizeOnce(fn) {
25842584
}
25852585
}
25862586

2587+

0 commit comments

Comments
 (0)