可记录、重放和存根 HTTP 交互的 JavaScript 库 Polly.JS
- 授权协议: Apache 2.0
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: https://netflix.github.io/pollyjs/
- 软件文档: https://github.com/Netflix/pollyjs
- 官方下载: https://github.com/Netflix/pollyjs
软件介绍
Polly.JS 是 Netflix 开源的一个独立、框架无关的 JavaScript 库,可记录,重放和存根 HTTP 交互。
Polly 利用本地浏览器 API 轻松调试请求和响应,同时让你能够使用简单、功能强大且直观的 API 全面控制每个请求,这将便于后期模拟不同的应用状态(例如加载、报错等)。
功能特性
支持 Fetch & XHR
简单、强大 & 直观的 API
一流的 Mocha & QUnit 测试助手
拦截、传递和附加事件
记录到磁盘或本地存储
时间减速或加速
Usage
import { Polly } from '@pollyjs/core';
describe('Netflix Homepage', function() {
it('should be able to sign in', async function() {
/*
Create a new polly instance.
By default, Polly will connect to both fetch and XHR browser APIs and
will record any requests that it hasn't yet seen while replaying ones it
has already recorded.
*/
const polly = new Polly('Sign In'); const { server } = polly; /* Intercept all Google Analytic requests and respond with a 200 */
server
.get('/google-analytics/*path')
.intercept((req, res) => res.sendStatus(200)); /* Pass-through all GET requests to /coverage */
server.get('/coverage').passthrough(); /* start: pseudo test code */
await visit('/login');
await fillIn('email', 'polly@netflix.com');
await fillIn('password', '@pollyjs');
await submit(); /* end: pseudo test code */
expect(location.pathname).to.equal('/browse'); /*
Calling `stop` will persist requests as well as disconnect from any
connected browser APIs (e.g. fetch or XHR).
*/
await polly.stop();
});
});
年入10万,17岁草根少年的网赚实战
陶秋丰 / 重庆出版集团 / 2009-3 / 28.00元
《年入10万:17岁草根少年的网赚实战》以一个17岁的在校大学生的真实故事为大家讲述草根少年的网络赚钱之旅。随着网络的普及以及网上应用的日益增多,要在网络上谋生并不难,比如网上写稿、网上兼职、威客赚钱、网上开店等,然而要利用互联网赚大钱,并成就一番事业,那么创建并运营一个独立的网站就是一个绝佳的选择。本书的作者正是经历了“网上写稿一网上各类兼职一策划并创建网站一网站推广与运营一年入10万”这一过程......一起来看看 《年入10万,17岁草根少年的网赚实战》 这本书的介绍吧!
