fix: show file chip for the selected file in binary body (#4562)

Co-authored-by: jamesgeorge007 <25279263+jamesgeorge007@users.noreply.github.com>
This commit is contained in:
Akash K
2024-11-27 15:05:35 +05:30
committed by GitHub
parent 5dccce39b4
commit 9cc1e47b39
11 changed files with 781 additions and 68 deletions

View File

@@ -56,7 +56,11 @@ const handleFileChange = (e: Event) => {
}
</script>
<template>
<span>
<div class="flex items-center px-4 py-2">
<HoppSmartFileChip v-if="props.modelValue.body">{{
props.modelValue.body.name
}}</HoppSmartFileChip>
<label :for="`attachment-binary-body`" class="p-0">
<input
:id="`attachment-binary-body`"
@@ -66,5 +70,5 @@ const handleFileChange = (e: Event) => {
@change="handleFileChange"
/>
</label>
</span>
</div>
</template>

View File

@@ -33,6 +33,10 @@ export class InterceptorsInspectorService extends Service implements Inspector {
req: Readonly<Ref<HoppRESTRequest | HoppRESTResponseOriginalRequest>>
) {
return computed((): InspectorResult[] => {
if (!req.value) {
return []
}
const isBinaryBody =
req.value.body.contentType === "application/octet-stream"

View File

@@ -27,25 +27,31 @@ export const REST_COLLECTIONS_MOCK: HoppCollection[] = [
{
v: 5,
name: "Echo",
folders: [],
requests: [
{
v: RESTReqSchemaVersion,
endpoint: "https://echo.hoppscotch.io",
name: "Echo test",
method: "GET",
endpoint: "https://echo.hoppscotch.io",
params: [],
headers: [],
method: "GET",
auth: { authType: "none", authActive: true },
preRequestScript: "",
testScript: "",
body: { contentType: null, body: null },
auth: {
authType: "none",
authActive: true,
},
body: {
contentType: null,
body: null,
},
requestVariables: [],
responses: {},
},
],
auth: { authType: "none", authActive: true },
headers: [],
folders: [],
},
]
@@ -53,20 +59,23 @@ export const GQL_COLLECTIONS_MOCK: HoppCollection[] = [
{
v: 5,
name: "Echo",
folders: [],
requests: [
{
v: 7,
name: "Echo test",
url: "https://echo.hoppscotch.io/graphql",
headers: [],
variables: '{\n "id": "1"\n}',
query: "query Request { url }",
auth: { authType: "none", authActive: true },
variables: '{\n "id": "1"\n}',
auth: {
authType: "none",
authActive: true,
},
},
],
auth: { authType: "none", authActive: true },
headers: [],
folders: [],
},
]