Don't try to print large network bodies

Summary:
The network plugin warns about network requests that cannot be properly deflated if they are big and binary. Not sure yet why that is the case and if that is something that should be addressed (planned T63909985 for that), but if the body is big and binary it causes problems for our logging.

While testing I had some requests that where 45m large, and Electron literally hang for a few minutes before recovering. Failed to capture that, but the test plan shows smaller cases of the problem

Reviewed By: jknoxville

Differential Revision: D20560083

fbshipit-source-id: 324eb180b203dd585814dba5c94373d8daee5dde
This commit is contained in:
Michel Weststrate
2020-03-23 06:42:08 -07:00
committed by Facebook GitHub Bot
parent d01da8ef9a
commit ef653100ed

View File

@@ -35,7 +35,7 @@ export function decodeBody(container: Request | Response): string {
// we need to decode the bytes here to display the correct unicode characters. // we need to decode the bytes here to display the correct unicode characters.
return decodeURIComponent(escape(b64Decoded)); return decodeURIComponent(escape(b64Decoded));
} catch (e) { } catch (e) {
console.warn('Discarding malformed body:', escape(b64Decoded)); console.warn('Discarding malformed body, size: ' + b64Decoded.length);
return ''; return '';
} }
} }