diff --git a/desktop/plugins/public/network/RequestDetails.tsx b/desktop/plugins/public/network/RequestDetails.tsx index 085ebac8880..ff7d34f88fa 100644 --- a/desktop/plugins/public/network/RequestDetails.tsx +++ b/desktop/plugins/public/network/RequestDetails.tsx @@ -36,6 +36,7 @@ import {ProtobufDefinitionsRepository} from './ProtobufDefinitionsRepository'; import {KeyValueItem, KeyValueTable} from './KeyValueTable'; import {CopyOutlined} from '@ant-design/icons'; import {stringify} from 'lossless-json'; +import {RequestAlert} from './fb-stubs/RequestAlert'; const {Text} = Typography; @@ -75,6 +76,8 @@ export default class RequestDetails extends Component { return ( <> + + @@ -553,7 +556,7 @@ class GraphQLBatchFormatter { } } -class GraphQLFormatter { +export class GraphQLFormatter { parsedServerTimeForFirstFlush(data: any) { const firstResponse = Array.isArray(data) && data.length > 0 ? data[0] : data; @@ -579,19 +582,24 @@ class GraphQLFormatter { ); } + static requestToObject(request: RequestWithData) { + const decoded = request.requestData; + if (!decoded) { + return undefined; + } + const data = queryToObj(bodyAsString(decoded)); + if (typeof data.variables === 'string') { + data.variables = JSON.parse(data.variables); + } + if (typeof data.query_params === 'string') { + data.query_params = JSON.parse(data.query_params); + } + + return data; + } formatRequest(request: RequestWithData) { if (request.url.indexOf('graphql') > 0) { - const decoded = request.requestData; - if (!decoded) { - return undefined; - } - const data = queryToObj(bodyAsString(decoded)); - if (typeof data.variables === 'string') { - data.variables = JSON.parse(data.variables); - } - if (typeof data.query_params === 'string') { - data.query_params = JSON.parse(data.query_params); - } + const data = GraphQLFormatter.requestToObject(request); return ; } } diff --git a/desktop/plugins/public/network/fb-stubs/RequestAlert.tsx b/desktop/plugins/public/network/fb-stubs/RequestAlert.tsx new file mode 100644 index 00000000000..08a04ad27bb --- /dev/null +++ b/desktop/plugins/public/network/fb-stubs/RequestAlert.tsx @@ -0,0 +1,14 @@ +/** + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + */ + +import {RequestWithData} from '../types'; + +export const RequestAlert = (_props: {request: RequestWithData}) => { + return null; +}; diff --git a/desktop/plugins/public/network/index.tsx b/desktop/plugins/public/network/index.tsx index 6d40113ab3e..8ed54aa20fd 100644 --- a/desktop/plugins/public/network/index.tsx +++ b/desktop/plugins/public/network/index.tsx @@ -437,6 +437,7 @@ export function plugin(client: PluginClient) { return { db, + client, columns, routes, nextRouteId,