Chromium Code Reviews| Index: chrome/browser/resources/google_now/utility.js |
| diff --git a/chrome/browser/resources/google_now/utility.js b/chrome/browser/resources/google_now/utility.js |
| index c66b9fff0fec812a4f7746999a01a58b487c1baa..27c445be3f3af284cf6d3014859d04e2c2bdfffc 100644 |
| --- a/chrome/browser/resources/google_now/utility.js |
| +++ b/chrome/browser/resources/google_now/utility.js |
| @@ -58,16 +58,18 @@ function verify(condition, message) { |
| /** |
| * Builds a request to the notification server. |
| + * @param {string} method Request method. |
| * @param {string} handlerName Server handler to send the request to. |
| - * @param {string} contentType Value for the Content-type header. |
| + * @param {string=} contentType Value for the Content-type header. |
| * @return {XMLHttpRequest} Server request. |
| */ |
| -function buildServerRequest(handlerName, contentType) { |
| +function buildServerRequest(method, handlerName, contentType) { |
| var request = new XMLHttpRequest(); |
| request.responseType = 'text'; |
| - request.open('POST', NOTIFICATION_CARDS_URL + '/' + handlerName, true); |
| - request.setRequestHeader('Content-type', contentType); |
| + request.open(method, NOTIFICATION_CARDS_URL + '/' + handlerName, true); |
| + if (contentType) |
|
robliao
2013/10/01 21:52:43
We should assert that the content type is allowed
vadimt
2013/10/01 22:02:46
Such asserts could make sense in libraries that ha
|
| + request.setRequestHeader('Content-type', contentType); |
| return request; |
| } |
| @@ -125,7 +127,7 @@ function sendErrorReport(error) { |
| trace: filteredStack |
| }; |
| - var request = buildServerRequest('jserrors', 'application/json'); |
| + var request = buildServerRequest('POST', 'jserrors', 'application/json'); |
| request.onloadend = function(event) { |
| console.log('sendErrorReport status: ' + request.status); |
| }; |