File tree Expand file tree Collapse file tree 5 files changed +415
-404
lines changed
console/atest-ui/src/views Expand file tree Collapse file tree 5 files changed +415
-404
lines changed Original file line number Diff line number Diff line change @@ -128,11 +128,8 @@ const handleTestResult = (e: any): void => {
128128 if (! isHistoryTestCase .value ) {
129129 handleTestResultError (e )
130130 }
131- const isFilePath = e .body .startsWith (" isFilePath-" )
132-
133- if (isFilePath ){
134- isResponseFile .value = true
135- } else if (e .body !== ' ' ){
131+ isResponseFile .value = e .body .startsWith (" isFilePath-" )
132+ if (! isResponseFile .value && e .body !== ' ' ){
136133 testResult .value .bodyLength = e .body .length
137134 try {
138135 // Try to parse as JSON, fallback to plain text if parsing fails
@@ -149,11 +146,11 @@ const handleTestResult = (e: any): void => {
149146 }
150147 }
151148
152- Cache .SetTestCaseResponseCache (suite + ' -' + name , {
153- body: testResult .value .bodyObject ,
154- output: e .output ,
155- statusCode: testResult .value .statusCode
156- } as TestCaseResponse )
149+ Cache .SetTestCaseResponseCache (suite + ' -' + name , {
150+ body: testResult .value .bodyObject ,
151+ output: e .output ,
152+ statusCode: testResult .value .statusCode
153+ } as TestCaseResponse )
157154
158155 parameters .value = [];
159156}
@@ -436,7 +433,9 @@ function downloadResponseFile(){
436433 } else {
437434 console .error (' No data to download.' );
438435 }
439- })
436+ }, (e ) => {
437+ UIAPI .ErrorTip (e );
438+ });
440439}
441440
442441function setDefaultValues(e ) {
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ async function DefaultResponseProcess(response: any): Promise<any> {
6767
6868 // For OK responses, handle content based on Content-Type
6969 const contentType = response . headers . get ( 'Content-Type' ) ?? '' ;
70- if ( contentType . startsWith ( 'text/plain' ) ) {
70+ if ( isTextReadableExpectJSON ( contentType ) ) {
7171 // For text/plain, directly return the text
7272 return await response . text ( ) ;
7373 }
@@ -90,6 +90,11 @@ async function DefaultResponseProcess(response: any): Promise<any> {
9090 }
9191}
9292
93+ const isTextReadableExpectJSON = ( contentType : string ) : boolean => {
94+ // Check if the content type is text-based
95+ return contentType . startsWith ( 'text/' ) || contentType === 'application/javascript' ;
96+ }
97+
9398interface AppVersion {
9499 version : string
95100 commit : string
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ export interface Suite {
3737
3838export interface TestResult {
3939 body : string
40- bodyObject : { }
40+ bodyObject : { } | null
4141 bodyText : string
4242 bodyLength : number
4343 output : string
@@ -46,7 +46,7 @@ export interface TestResult {
4646 header : Pair [ ]
4747
4848 // inner fields
49- originBodyObject :{ }
49+ originBodyObject :{ } | null
5050}
5151
5252export interface Pair {
You can’t perform that action at this time.
0 commit comments