diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js
index 0575af711d..5e5a0decc6 100644
--- a/chrome/content/zotero/xpcom/http.js
+++ b/chrome/content/zotero/xpcom/http.js
@@ -82,6 +82,7 @@ Zotero.HTTP = new function() {
*
dontCache - If set, specifies that the request should not be fulfilled from the cache
* foreground - Make a foreground request, showing certificate/authentication dialogs if necessary
* headers - HTTP headers to include in the request
+ * logBodyLength - Length of request body to log (defaults to 1024)
* timeout - Request timeout specified in milliseconds
* requestObserver - Callback to receive XMLHttpRequest after open()
* responseType - The type of the response. See XHR 2 documentation for legal values
@@ -107,15 +108,16 @@ Zotero.HTTP = new function() {
dispURL = dispURL.replace(/key=[^&]+&?/, "").replace(/\?$/, "");
if (options.body && typeof options.body == 'string') {
- var bodyStart = options.body.substr(0, 1024);
+ let len = options.logBodyLength !== undefined ? options.logBodyLength : 1024;
+ var bodyStart = options.body.substr(0, len);
// Don't display sync password or session id in console
bodyStart = bodyStart.replace(/password":"[^"]+/, 'password":"********');
bodyStart = bodyStart.replace(/password=[^&]+/, 'password=********');
bodyStart = bodyStart.replace(/sessionid=[^&]+/, 'sessionid=********');
- Zotero.debug("HTTP "+method+" "
- + (options.body.length > 1024 ?
- bodyStart + '... (' + options.body.length + ' chars)' : bodyStart)
+ Zotero.debug("HTTP " + method + ' "'
+ + (options.body.length > len
+ ? bodyStart + '\u2026" (' + options.body.length + ' chars)' : bodyStart + '"')
+ " to " + dispURL);
} else {
Zotero.debug("HTTP " + method + " " + dispURL);