【发布时间】:2022-07-10 23:09:16
【问题描述】:
我在 ArrayList 中有一些客户,当我想通过 Postman 删除(带 id)时它不起作用:500 - 内部错误。请问有人可以帮我吗?
删除客户
删除 http://localhost:8080/api/customers/{customerId}
@DeleteMapping("/api/customers{customerId}")
public void deleteCustomer(@PathVariable Long customerId) {
customers.remove(this.customers.get(Math.toIntExact(customerId)));
}
【问题讨论】:
-
到目前为止的答案表明罪魁祸首是您的路径(在客户之后缺少斜线)。这绝对是一个问题,但这不会导致 500 内部服务器错误。分享错误的内容,只有这样才能回答这个问题......是的,你也必须修复那个路径。
标签: spring rest http-delete