From b2ba27f4c40b7a5ef2b8da9a6f7659bed68bbf21 Mon Sep 17 00:00:00 2001 From: lqqyt2423 <974923609@qq.com> Date: Mon, 8 Nov 2021 17:44:45 +0800 Subject: [PATCH] show Query String Parameters --- addon/web/client/src/components/ViewFlow.tsx | 30 ++++++++++++++++++-- addon/web/client/src/message.ts | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/addon/web/client/src/components/ViewFlow.tsx b/addon/web/client/src/components/ViewFlow.tsx index 68841eb..0f3717d 100644 --- a/addon/web/client/src/components/ViewFlow.tsx +++ b/addon/web/client/src/components/ViewFlow.tsx @@ -34,7 +34,7 @@ class ViewFlow extends React.Component { const { flow } = this.props if (!flow) return null const response = flow.response - if(!response) return null + if (!response) return null if (!(response.body && response.body.byteLength)) { return
No response
@@ -62,6 +62,14 @@ class ViewFlow extends React.Component { const request = flow.request const response: IResponse = (flow.response || {}) as any + // Query String Parameters + const searchItems: Array<{ key: string; value: string }> = [] + if (flow.url && flow.url.search) { + flow.url.searchParams.forEach((value, key) => { + searchItems.push({ key, value }) + }) + } + return (
@@ -100,7 +108,7 @@ class ViewFlow extends React.Component { { !(flowTab === 'Headers') ? null :
-

+ }}>{this.state.copied ? 'Copied' : 'Copy as cURL'}

General

@@ -159,6 +167,22 @@ class ViewFlow extends React.Component {
+ { + !(searchItems.length) ? null : +
+

Query String Parameters

+
+ { + searchItems.map(({ key, value }) => { + return ( +

{key}: {value}

+ ) + }) + } +
+
+ } + { !(request.body && request.body.byteLength) ? null :
diff --git a/addon/web/client/src/message.ts b/addon/web/client/src/message.ts index 573b934..6a07cf4 100644 --- a/addon/web/client/src/message.ts +++ b/addon/web/client/src/message.ts @@ -55,7 +55,7 @@ export class Flow { public request: IRequest public response: IResponse | null = null - private url: URL + public url: URL private path: string private _size = 0 private size = '0'