From bd943ffe85a08f448e39a02b4983add570b81ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adomas=20Ven=C4=8Dkauskas?= Date: Thu, 22 Dec 2016 13:14:04 +0200 Subject: [PATCH] Add a friendlier GET request message for /connector/ping --- chrome/content/zotero/xpcom/server_connector.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/server_connector.js b/chrome/content/zotero/xpcom/server_connector.js index 83e3427c0..97ebd1f15 100644 --- a/chrome/content/zotero/xpcom/server_connector.js +++ b/chrome/content/zotero/xpcom/server_connector.js @@ -773,17 +773,22 @@ Zotero.Server.Connector.GetClientHostnames.prototype = { Zotero.Server.Connector.Ping = function() {}; Zotero.Server.Endpoints["/connector/ping"] = Zotero.Server.Connector.Ping; Zotero.Server.Connector.Ping.prototype = { - supportedMethods: ["POST"], + supportedMethods: ["GET", "POST"], supportedDataTypes: ["application/json", "text/plain"], permitBookmarklet: true, /** - * Sends nothing - * @param {String} data POST data or GET query string - * @param {Function} sendResponseCallback function to send HTTP response + * Sends 200 and HTML status on GET requests + * @param data {Object} request information defined in connector.js */ - init: function(postData, sendResponseCallback) { - sendResponseCallback(200); + init: function(data) { + if (data.method == 'GET') { + return [200, "text/html", '' + + 'Zotero Connector Server is Available' + + 'Zotero Connector Server is Available']; + } else { + return [200]; + } } }