Skip to content

Commit 6fb6d9a

Browse files
committed
Return proper JSON on DELETE endpoint
1 parent 459e6cb commit 6fb6d9a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/eu/openanalytics/containerproxy/api/ProxyController.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
*/
2121
package eu.openanalytics.containerproxy.api;
2222

23+
import java.util.HashMap;
2324
import java.util.List;
25+
import java.util.Map;
2426
import java.util.Set;
2527

2628
import javax.inject.Inject;
@@ -88,11 +90,14 @@ public ResponseEntity<Proxy> startProxy(@RequestBody ProxySpec proxySpec) {
8890
}
8991

9092
@RequestMapping(value="/api/proxy/{proxyId}", method=RequestMethod.DELETE, produces=MediaType.APPLICATION_JSON_VALUE)
91-
public ResponseEntity<String> stopProxy(@PathVariable String proxyId) {
93+
public ResponseEntity<Map<String, String>> stopProxy(@PathVariable String proxyId) {
9294
Proxy proxy = proxyService.findProxy(p -> p.getId().equals(proxyId), false);
9395
if (proxy == null) return new ResponseEntity<>(HttpStatus.NOT_FOUND);
9496

9597
proxyService.stopProxy(proxy, true, false);
96-
return new ResponseEntity<>("Proxy stopped", HttpStatus.OK);
98+
return ResponseEntity.ok(new HashMap<String, String>() {{
99+
put("status", "success");
100+
put("message", "proxy_stopped");
101+
}});
97102
}
98103
}

0 commit comments

Comments
 (0)