GreenFaith / GreenFaith.github.io

wiki.shixiz.com
1 stars 0 forks source link

Restful:keep simple #8

Open GreenFaith opened 10 years ago

GreenFaith commented 10 years ago

[跨域请求]

解决不同域名资源共享(api server 与 client 在不同域名下),绕过浏览器 js 同源策略。 nginx http://www.w3.org/wiki/CORS_Enabled

上面那句还不够

Access-Control-Allow-Origin: [the same origin from the request]

Access-Control-Allow-Methods: GET, POST, PUT

Access-Control-Allow-Headers: [the same ACCESS-CONTROL-REQUEST-HEADERS from request]
GreenFaith commented 10 years ago

「测试」

api server 的黑盒测试,开发中 curl 之类的工具必不可免。 但在需要反复修改验证的要求下,手动测试绝逼崩溃而且肯定不全面不靠谱。 这时候请使用 自动化 的 api 测试工具,don't repeat yourself!