All Projects → nettofarah → Axios Vcr

nettofarah / Axios Vcr

Licence: mit
📼 Record and Replay requests in JavaScript

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Axios Vcr

React Bootstrap Webpack Starter
ReactJS 16.4 + new React Context API +react Router 4 + webpack 4 + babel 7+ hot Reload + Bootstrap 4 + styled-components
Stars: ✭ 103 (-14.88%)
Mutual labels:  axios
React Nativeish
React Native / React Native Web Boilerplate
Stars: ✭ 106 (-12.4%)
Mutual labels:  axios
Reeakt
A modern React boilerplate to awesome web applications
Stars: ✭ 116 (-4.13%)
Mutual labels:  axios
Ashen Blog
使用koa 2 + vue 2搭建自己的博客系统
Stars: ✭ 104 (-14.05%)
Mutual labels:  axios
Axios Rate Limit
Rate limit for axios
Stars: ✭ 106 (-12.4%)
Mutual labels:  axios
Auth Module
auth.nuxtjs.org
Stars: ✭ 1,624 (+1242.15%)
Mutual labels:  axios
Myxhr
TypeScript 重构 Axios 经验分享,包括开发技巧, API 实现,XMLHttpRequest 运用,单元测试等
Stars: ✭ 102 (-15.7%)
Mutual labels:  axios
Todolist Frontend Vuejs
Front-end application for Todolist Web application built with Laravel and Vue.js
Stars: ✭ 120 (-0.83%)
Mutual labels:  axios
Webchat
A realtime chat for web
Stars: ✭ 106 (-12.4%)
Mutual labels:  axios
Vue Api Request
Control your API calls by using an amazing component which supports axios and vue-resource
Stars: ✭ 116 (-4.13%)
Mutual labels:  axios
Iview Vue Admin
iView vue Admin / An admin management system template
Stars: ✭ 105 (-13.22%)
Mutual labels:  axios
Request
go request, go http client
Stars: ✭ 105 (-13.22%)
Mutual labels:  axios
Seemusic
Vue 云音乐播放器,网易云音乐API,可听网易云高品质付费歌曲。 Vue music player
Stars: ✭ 112 (-7.44%)
Mutual labels:  axios
Seppf
普兰能效平台开源版(前端)
Stars: ✭ 104 (-14.05%)
Mutual labels:  axios
React Antd Admin
后台前端管理系统,基于react、typescript、antd、dva及一些特别优秀的开源库实现
Stars: ✭ 117 (-3.31%)
Mutual labels:  axios
Vue2 Shop
A shop developed with Vue2 + Vue-router + Axios + Vuex + Node + Express + MongoDB + Webpack
Stars: ✭ 103 (-14.88%)
Mutual labels:  axios
Ruoyi Vue Fast
(RuoYi)官方仓库 基于SpringBoot,Spring Security,JWT,Vue & Element 的前后端分离权限管理系统
Stars: ✭ 107 (-11.57%)
Mutual labels:  axios
React Cloud Music
React 16.8打造精美音乐WebApp
Stars: ✭ 1,722 (+1323.14%)
Mutual labels:  axios
Rxios
A RxJS wrapper for axios
Stars: ✭ 119 (-1.65%)
Mutual labels:  axios
Webpack Seed
🚀 A Multi-Page Application base on webpack and babel. webpack搭建基于ES6,支持模板的多页面项目
Stars: ✭ 113 (-6.61%)
Mutual labels:  axios

axios-vcr

📼 Record and Replay requests in JavaScript

axios-vcr is a set of axios middlewares that allow you to record and replay axios requests. Use it for reliable, fast and more deterministic tests.

Build Status

Features

  • [x] Record http requests to JSON cassette files
  • [x] Replay requests from cassete files
  • [x] Multiple request/response fixtures per cassette
  • [ ] Cassette expiration logic
  • [ ] Mocha integration
  • [ ] non-global axios instances support

Installation

$ npm install --save-dev axios-vcr

Usage

Using axios-vcr is very simple. All you need to do is to provide a cassette path and wrap your axios code with axiosVCR.mountCassette and axiosVCR.ejectCassette.

const axiosVCR = require('axios-vcr');

axiosVCR.mountCassette('./test/fixtures/cats.json')

axios.get('https://reddit.com/r/cats.json').then(response => {
  // axios-vcr will store the remote response from /cats.json
  // in ./test/fixtures/cats.json
  // Subsequent requests will then load the response directly from the file system

  axiosVCR.ejectCassette('https://reddit.com/r/cats.json')
})

Usage in a test case

it('makes your requests load faster and more reliably', function(done) {
  // mount a cassette
  axiosVCR.mountCassette('./fixtures/test_case_name.json')

  myAPI.fetchSomethingFromRemote().then(function(response) {
    assert.equal(response.something, 'some value')
    done()

    // Eject the cassette when all your promises have been fulfilled
    axiosVCR.ejectCassette('./fixture/test_case_name.json')
  })
})

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nettofarah/axios-vcr. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Code of Conduct.

To run the specs check out the repo and follow these steps:

$ npm install
$ npm test

License

The module is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].