Rest.js 0.9 Released

rest.js是一个RESTful HTTP客户端,现已成为Cujo.js的一部分。它通过可组合的拦截器提供超出传统XMLHttpRequest的功能,允许开发者在不篡改配置的情况下安全地共享客户端。rest.js支持主流浏览器及Node.js,内置多种拦截器,便于实现如内容协商、HATEOAS、身份验证等高级功能。

Releases
Jeremy Grelle
March 28, 2013

Dear Spring Community,

Today we’re excited to announce that rest.js is now part of Cujo.js and that rest.js 0.9 has been released.

https://github.com/cujojs/rest

rest.js is a RESTful HTTP client. It goes far beyond the typical XMLHttpRequest abstraction developers are accustomed to in other frameworks. rest.js is built upon composable interceptors that incrementally add new functionality to a client. Configured clients are tamper proof and can be safely shared within an application. If a portion of the application needs specific behavior, it can chain further interceptors on the common client creating a new client that’s independent of the remainder of the application.

As a quick example, if your application requires basic authentication, you can configure the basicAuth interceptor with the username and password once, rather then being forced to add the credentials to every place in the application that makes a request. When your application adds new authentication requirements, such as oAuth, you only need to replace the basicAuth interceptor with the oAuth interceptor in one place. All requests made with the resulting client get the new behavior automatically.

Out of the box rest.js works in every major browser (and then some) plus Node.js. There are interceptors for content negotiation, HATEOAS, basic auth, oAuth (the implicit flow), error detection, retries, timeouts, JSONP and of course fall backs for IE’s XHR and cross domain request support. It’s dirt easy to create new interceptors to apply your own behavior.
comments powered by Disqus

translate:
翻译:

休息.js是一个RESTful HTTP客户端。它远远超出了开发人员在其他框架中习惯的典型XMLHttpRequest抽象。休息.js是建立在可组合的拦截器之上的,这些拦截器以增量方式向客户端添加新功能。配置的客户端是防篡改的,可以在应用程序中安全共享。如果应用程序的一部分需要特定的行为,它可以将更多的拦截器链接到公共客户机上,从而创建一个独立于应用程序其余部分的新客户机。
作为一个简单的例子,如果您的应用程序需要基本身份验证,您可以使用用户名和密码配置basicAuth拦截器一次,而不是被迫将凭据添加到应用程序中发出请求的每个位置。当您的应用程序添加新的身份验证要求(如oAuth)时,您只需要在一个地方用oAuth拦截器替换basicAuth拦截器。使用生成的客户端发出的所有请求都将自动获取新行为。
开箱即用休息.js适用于所有主要浏览器(然后是一些)以及Node.js节点. 有用于内容协商、HATEOAS、basic auth、oAuth(隐式流)、错误检测、重试、超时、JSONP的拦截器,当然还有用于IE的XHR和跨域请求支持的回退拦截器。很容易创建新的拦截器来应用您自己的行为。
由DISPS提供的评论

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值