gpt4 book ai didi

spring - HttpStatus.OK 和 HttpStatus.ACCEPTED 之间的区别

转载 作者:行者123 更新时间:2023-12-02 13:25:44 26 4
gpt4 key购买 nike

我即将实现一个 REST api。我想知道 HttpStatus.OKHttpStatus.ACCEPTED 之间有什么区别:

return new ResponseEntity<User>(u, HttpStatus.OK));

还有

return new ResponseEntity<User>(u, HttpStatus.ACCEPTED);

最佳答案

根据 Spring 文档 link

HttpStatus.OK

200 Ok means The request has succeeded. The information returned with the response is dependent on the method used in the request

HttpStatus.ACCEPTED:

202 Accepted. means The request has been accepted for processing, but the processing has not been completed. The request might or might not eventually be acted upon, as it might be disallowed when processing actually takes place.

有关 HTTP 响应状态代码定义的更多信息,请访问此 link

关于spring - HttpStatus.OK 和 HttpStatus.ACCEPTED 之间的区别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30105216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com