diff --git a/frontend/src/business/components/api/definition/ApiDefinition.vue b/frontend/src/business/components/api/definition/ApiDefinition.vue index 1c07087dfd..a3d9095a71 100644 --- a/frontend/src/business/components/api/definition/ApiDefinition.vue +++ b/frontend/src/business/components/api/definition/ApiDefinition.vue @@ -154,7 +154,10 @@ } }, handleTabAdd(e) { - let api = {status: "Underway", method: "GET", userId: getCurrentUser().id, url: "", protocol: this.currentProtocol}; + let api = { + status: "Underway", method: "GET", userId: getCurrentUser().id, + url: "", protocol: this.currentProtocol, environmentId: "" + }; this.handleTabsEdit(this.$t('api_test.definition.request.title'), e, api); }, handleTabClose() { diff --git a/frontend/src/business/components/api/definition/components/ApiConfig.vue b/frontend/src/business/components/api/definition/components/ApiConfig.vue index e9e1ae765b..1df8d46921 100644 --- a/frontend/src/business/components/api/definition/components/ApiConfig.vue +++ b/frontend/src/business/components/api/definition/components/ApiConfig.vue @@ -64,7 +64,11 @@ break; } if (this.currentApi.response != null && this.currentApi.response != 'null' && this.currentApi.response != undefined) { - this.response = new ResponseFactory(JSON.parse(this.currentApi.response)); + if (Object.prototype.toString.call(this.currentApi.response).match(/\[object (\w+)\]/)[1].toLowerCase() === 'object') { + this.response = this.currentApi.response; + } else { + this.response = new ResponseFactory(JSON.parse(this.currentApi.response)); + } } else { this.response = {headers: [], body: new Body(), statusCode: [], type: "HTTP"}; } diff --git a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue index c65a36cc60..1b2ba625bb 100644 --- a/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue +++ b/frontend/src/business/components/api/definition/components/runtest/RunTestHTTPPage.vue @@ -236,7 +236,7 @@ let hasEnvironment = false; for (let i in this.environments) { if (this.environments[i].id === this.api.environmentId) { - this.api.environment = this.environments[i]; + this.api.environmentId = this.environments[i]; hasEnvironment = true; break; } @@ -261,7 +261,8 @@ environmentChange(value) { for (let i in this.environments) { if (this.environments[i].id === value) { - this.api.request.useEnvironment = this.environments[i].id; + this.api.environmentId = value; + this.api.request.useEnvironment = value; break; } }