-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
spec on not found #28
Comments
https://github.com/cn/GB2260/blob/develop/spec.md#prefecture |
@fahchen 不是这个,是 |
我的意思是,既然这个方法的未找到是这样定义的,那这里是不是也应该保持一致 |
我的实现是nil。从规范上看,这儿返回的是一个json的object,也就是其他语言的struct或者object,大部分是后,可以用空的形式来表示没有找到,我建议用none/nil/null 这样的来表示。 |
从 REST API 的设计角度考虑
针对 实现上就像 @damonchen 那样,如果找到该 对于某些静态类型(?)语言可能需要费一些周折,对于这类语言,可以引入 Exception,当资源未找到时触发 Exception。 |
IMO 使用异常,还是 nil 值,还是 Optional 类型,看各语言的 idiomatic 用法即可… spec 也可以仅要求这一点 |
定义未找到 code 时返回什么?
The text was updated successfully, but these errors were encountered: