diff --git a/src/SwiftTestingFrameworkAPI/Controllers/VnetPeeringController.cs b/src/SwiftTestingFrameworkAPI/Controllers/VnetPeeringController.cs index 989c17a..6360330 100644 --- a/src/SwiftTestingFrameworkAPI/Controllers/VnetPeeringController.cs +++ b/src/SwiftTestingFrameworkAPI/Controllers/VnetPeeringController.cs @@ -1,4 +1,5 @@ -using Microsoft.AspNetCore.Http.Extensions; +using Azure.Core; +using Microsoft.AspNetCore.Http.Extensions; using Microsoft.AspNetCore.Mvc; using SwiftTestingFrameworkAPI.Utils; @@ -26,9 +27,10 @@ public TestResponse GetInfo() } [HttpPost] - public TestResponse PeerVM() + public ObjectResult PeerVM() { Helper.ProcessOutput p; + TestResponse testResponse; try { @@ -43,16 +45,19 @@ public TestResponse PeerVM() if (p.ExitCode == 0) { - return new TestResponse(Constants.ApiVersion, TestName, "Success", p.StdOutput, string.Empty); + testResponse = new TestResponse(Constants.ApiVersion, TestName, "Success", p.StdOutput, string.Empty); + return StatusCode(200, testResponse); } else { - return new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, p.StdError); + testResponse = new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, p.StdError); + return StatusCode(555, testResponse); } } catch (Exception ex) { - return new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, ex.Message + ex.StackTrace); + testResponse = new TestResponse(Constants.ApiVersion, TestName, "Failure", string.Empty, ex.Message + ex.StackTrace); + return StatusCode(555, testResponse); } } }