www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit bd943ffe85a08f448e39a02b4983add570b81ebb
parent 455f23df4b769827101f4022892251a767d5e310
Author: Adomas VenĨkauskas <adomas.ven@gmail.com>
Date:   Thu, 22 Dec 2016 13:14:04 +0200

Add a friendlier GET request message for /connector/ping

Diffstat:
Mchrome/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 @@ -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", '<!DOCTYPE html><html><head>' + + '<title>Zotero Connector Server is Available</title></head>' + + '<body>Zotero Connector Server is Available</body></html>']; + } else { + return [200]; + } } }