Log POST request body for server requests

This commit is contained in:
Dan Stillman 2021-02-05 17:51:08 -05:00
parent 55acf9a0c0
commit cf132fdd29

View file

@ -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
}