Improve request formatting
Summary: This diff adds several improvements to displaying requests / responses in the network plugin 1. If there is no formatter rendering the data, the data is rendered 'raw' 2. For binary data, `(binary data)` text is printed, rather than an empty box 3. For request that have an empty request / response, `(empty)` is printed, rather than an empty box 4. If a formatter is applied, we show which formatter was used, which makes it easier to debug / spot / report issues 5. If the graphql formatter can't parse the data because it is truncated, it won't return anything, so that it falls back to the next formatter (urlencoder) to take care of the presentation Changelog: [Network plugin] Improved presentation of request / response bodies and fixed issues where they would sometimes not be displayed. Reviewed By: jknoxville Differential Revision: D22865373 fbshipit-source-id: 912d2f27269a4c9edbf62f2039d46ccf90a008af
This commit is contained in:
committed by
Facebook GitHub Bot
parent
45d461a3b8
commit
b7cfb509f1
@@ -33,7 +33,9 @@ export function decodeBody(container: Request | Response): string {
|
||||
|
||||
return b64Decoded;
|
||||
} catch (e) {
|
||||
console.warn('Discarding malformed body, size: ' + b64Decoded.length);
|
||||
console.warn(
|
||||
`Flipper failed to decode request/response body (size: ${b64Decoded.length}): ${e}`,
|
||||
);
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@@ -52,6 +54,9 @@ function decompress(body: string): string {
|
||||
} catch (e) {
|
||||
// Sometimes Content-Encoding is 'gzip' but the body is already decompressed.
|
||||
// Assume this is the case when decompression fails.
|
||||
if (!('' + e).includes('incorrect header check')) {
|
||||
console.warn('decompression failed: ' + e);
|
||||
}
|
||||
}
|
||||
|
||||
return body;
|
||||
|
||||
Reference in New Issue
Block a user