Rest.js 0.9 是一个基于 JavaScript 的轻量级 REST 客户端库(注意:需区分于更知名的 Restful.js 或其他同名项目;目前并无广泛公认的主流库名为 “Rest.js” 版本 0.9 的官方发布记录)。可能您指的是某个特定组织/开发者维护的私有或小众库(如早期由 Mozilla 或某开源团队实验性发布的 rest.js),但截至 2024 年,没有权威来源(如 npm 官方、GitHub 主流仓库、MDN 或知名技术媒体)证实存在广为人知的 “Rest.js 0.9” 正式版本发布。
常见混淆点:
rest(npm 包名,已归档):曾是一个简单的 HTTP 客户端(作者:mikeal),最后版本为 0.12.x(非 0.9),已于 2017 年停止维护;restful.js、axios、ky、node-fetch等是当前主流替代方案;- 若您指前端框架中某插件(如 Vue/React 生态中的 rest.js 封装),需提供上下文(如 GitHub 仓库链接)才能准确定位。
建议核实名称拼写、来源渠道(如 GitHub 仓库 URL)或检查是否为内部项目代号。
# 可尝试查询 npm(若存在)
npm view rest version
# 或搜索历史版本
npm view rest time
Rest.js 0.9 Released
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


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

被折叠的 条评论
为什么被折叠?



