返回http 400状态代码无效

时间:2020-09-03 07:38:05

标签: angular http

每个网页都说这行代码

return new ResponseEntity<Customer>(HttpStatus.BAD_REQUEST);

返回错误代码400,但是当我强制执行该操作时,我得到“ 405 Method Not Allowed”。 为什么?

@PutMapping(value = "/rest/customer/{id}")
        public Object updateCustomer(@PathVariable(name = "id") long id,
                                     @RequestBody Customer customer) {
        if (id != customer.getId()) {
            return new ResponseEntity<Customer>(HttpStatus.BAD_REQUEST);
        } else {

0 个答案:

没有答案