From 1f0876dd7198ec59e9f5dadf310e56a1c84395bd Mon Sep 17 00:00:00 2001 From: dongfang <1136005348@qq.com> Date: Wed, 12 Feb 2025 03:16:07 +0000 Subject: [PATCH] use stringService in requestHttp --- Server/service/networkService.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Server/service/networkService.js b/Server/service/networkService.js index 741b69bef..89dfe85d1 100644 --- a/Server/service/networkService.js +++ b/Server/service/networkService.js @@ -144,7 +144,7 @@ class NetworkService { const code = error.response?.status || this.NETWORK_ERROR; httpResponse.code = code; httpResponse.status = false; - httpResponse.message = this.http.STATUS_CODES[code] || "Network Error"; + httpResponse.message = this.http.STATUS_CODES[code] || this.stringService.httpNetworkError; return httpResponse; } @@ -173,7 +173,7 @@ class NetworkService { const isJson = contentType?.includes('application/json'); if (!isJson) { httpResponse.status = false; - httpResponse.message = "Response Not JSON"; + httpResponse.message = this.stringService.httpNotJson; return httpResponse; } @@ -181,14 +181,14 @@ class NetworkService { result = jmespath.search(result, jsonPath); } catch (error) { httpResponse.status = false; - httpResponse.message = "JSONPath Search Error"; + httpResponse.message = this.stringService.httpJsonPathError; return httpResponse; } } if (result === null || result === undefined) { httpResponse.status = false; - httpResponse.message = "Empty Result"; + httpResponse.message = this.stringService.httpEmptyResult; return httpResponse; } @@ -199,7 +199,7 @@ class NetworkService { else match = result === expectedValue; httpResponse.status = match; - httpResponse.message = match ? "Match" : "Not Match"; + httpResponse.message = match ? this.stringService.httpMatchSuccess : this.stringService.httpMatchFail; return httpResponse; } catch (error) { error.service = this.SERVICE_NAME;