Skip to content

Commit

Permalink
made some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranav-b-7 committed Feb 3, 2021
1 parent 7dc450c commit 3d4f822
Showing 1 changed file with 16 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,20 @@ class OpsmxVisibilityController {
@ResponseBody Object triggerV1ApprovalGate(@PathVariable("id") Integer id,
@RequestBody(required = false) Object data) {
Response response = opsmxVisibilityService.triggerV1ApprovalGate(id, data)
InputStream inputStream = response.getBody().in()
InputStream inputStream = null
try {
HttpHeaders headers = new HttpHeaders()
response.getHeaders().forEach({ header ->
headers.add(header.getName(), header.getValue())
})
if (response.getBody()!=null){
inputStream = response.getBody().in()
} else {
return new ResponseEntity(headers, HttpStatus.valueOf(response.getStatus()))
}
String responseBody = new String(IOUtils.toByteArray(inputStream))
if (responseBody == null){
responseBody = new String()
if (responseBody == null || (responseBody!=null && responseBody.trim().isEmpty())){
return new ResponseEntity(headers, HttpStatus.valueOf(response.getStatus()))
}
return new ResponseEntity(responseBody, headers, HttpStatus.valueOf(response.getStatus()))
} finally{
Expand All @@ -83,15 +88,20 @@ class OpsmxVisibilityController {
@RequestBody(required = false) Object data) {

Response response = opsmxVisibilityService.triggerV2ApprovalGate(id, data)
InputStream inputStream = response.getBody().in()
InputStream inputStream = null
try {
HttpHeaders headers = new HttpHeaders()
response.getHeaders().forEach({ header ->
headers.add(header.getName(), header.getValue())
})
if (response.getBody()!=null){
inputStream = response.getBody().in()
} else {
return new ResponseEntity(headers, HttpStatus.valueOf(response.getStatus()))
}
String responseBody = new String(IOUtils.toByteArray(inputStream))
if (responseBody == null){
responseBody = new String()
if (responseBody == null || (responseBody!=null && responseBody.trim().isEmpty())){
return new ResponseEntity(headers, HttpStatus.valueOf(response.getStatus()))
}
return new ResponseEntity(responseBody, headers, HttpStatus.valueOf(response.getStatus()))
} finally{
Expand Down

0 comments on commit 3d4f822

Please sign in to comment.