From cf132fdd29fb81b6cf35198103b8e79e346bc8bb Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Fri, 5 Feb 2021 17:51:08 -0500 Subject: [PATCH] Log POST request body for server requests --- chrome/content/zotero/xpcom/server.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrome/content/zotero/xpcom/server.js b/chrome/content/zotero/xpcom/server.js index cf9c65f8c9..0212db2168 100755 --- a/chrome/content/zotero/xpcom/server.js +++ b/chrome/content/zotero/xpcom/server.js @@ -323,6 +323,18 @@ Zotero.Server.DataListener.prototype._headerFinished = function() { */ Zotero.Server.DataListener.prototype._bodyData = function() { if(this.body.length >= this.bodyLength) { + let logContentTypes = [ + 'text/plain', + 'application/json' + ]; + let noLogEndpoints = [ + '/connector/saveSingleFile' + ]; + if (this.body != '{}' + && logContentTypes.includes(this.contentType) + && !noLogEndpoints.includes(this.pathname)) { + Zotero.debug(Zotero.Utilities.ellipsize(this.body, 1000, false, true), 5); + } // handle envelope this._processEndpoint("POST", this.body); // async }