基于 Fetch API 封装的 HTTP Client Fetch HTTP Client
- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://github.com/starlight36/fetch-http-client
- 软件文档: https://github.com/starlight36/fetch-http-client/blob/master/README.md
软件介绍
一个基于 Fetch API 封装的 HTTP Client,可用于浏览器及其他兼容环境中,设计之初是为了ReactJS和ReactNative访问后端RestAPI使用。比其他基于Fetch API的封装优势在于,它的中间件机制支持对请求和应答进行异步处理。
安装:
npm install fetch-http-client --save
使用:
import FetchHttpClient, { json } from 'fetch-http-client'; // Create a new client object. const client = new FetchHttpClient('http://api.example.com/endpoint'); // Add access token client.addMiddleware(request => { request.options.headers['X-Access-Token'] = 'secret'; }); // Add json support client.addMiddleware(json()); // Add Logging client.addMiddleware(request => response => { console.log(request, response); }); // Fire request. client.get('test').then(response => console.log(response.jsonData)); // Path variables support. client.get('users/{id}', { uriParams: { id: 1 } }).then(response => console.log(response.jsonData));
预处理异步请求的中间件示例,从存储中异步读取accessToken,并添加到请求头中:
// Add access token asynchronously client.addMiddleware(request => { return AsynchronousStorage.fetch('accessToken').then(token => { request.options.headers['X-Access-Token'] = token; return request; }); });
实用Common Lisp编程
Peter Seibel / 田春 / 人民邮电出版社 / 2011-10 / 89.00元
由塞贝尔编著的《实用Common Lisp编程》是一本不同寻常的Common Lisp入门书。《实用Common Lisp编程》首先从作者的学习经过及语言历史出发,随后用21个章节讲述了各种基础知识,主要包括:REPL及Common Lisp的各种实现、S-表达式、函数与变量、标准宏与自定义宏、数字与字符以及字符串、集合与向量、列表处理、文件与文件I/O处理、类、FORMAT格式、符号与包,等等。......一起来看看 《实用Common Lisp编程》 这本书的介绍吧!