Giter Site home page Giter Site logo

gaoqing / network-spinner-devtool Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 4.0 10.5 MB

Browser Devtool to introduce latency to http requests to specifiable endpoints, aiming at testing/debugging any race condition issues in between different requests. Requests like being spinning.

JavaScript 75.06% HTML 24.94%
chrome-extension devtools devtools-extension delay-response delay-request postpone-request request-throttling

network-spinner-devtool's Introduction

Network Spinner

This network-spinner-devtool is a browser devtools extension, with capacity of URL level configuration and control, to allow introducing delay before sending http request or after receiving response(support in firefox only).

Although browser itself provide throttling in different network conditions(slow 3G etc), that will impact all requests, that is not fit for some purpose.

This tool can config target URLs to which requests will be delayed deliberately. It can be helpful to assist debugging potential race condition issues might be hidden inside complex logic, which can mix with fast/slow, stable/unstable endpoints.

It supports both requests delaying and requests blocking(browser also support blocking anyway)

A quick demo:

til

Browser supports

It supports both Firefox and Chrome.

  • Firefox, it well supports delaying requests to config endpoints in a NON-BLOCKING way, for example: 5 requests to 5 different endpoints, and assume they are fired in consecutive order, one will not block the others, each timer will be started exactly at the moment the request being issued, all 5 timers will be running in parallel and independently.

  • Chrome, however it delays requests to config endpoints in BLOCKING way, for example: 5 requests to 5 different endpoints, and assume they are fired in consecutive order, but the 1st request will block 2nd request, means the timer of 2nd request can only start after 1st timer elapsed, the 3rd timer will need to wait the 2nd's time elapsed, 3rd block 4th, 4th block 5th etc.

Choose the test browser based on above non-blocking / blocking feature.

Usage

It is deployed in Chrome web store, can install directly from there (https://chrome.google.com/webstore/detail/network-spinner/klhfgmmihbgojnnbhdbnefjmiidlgfld)

or locally you can clone this codebase, then install and try:

  • In Firefox: Open the about:debugging page, click "This Firefox" (in newer versions of Firefox), click "Load Temporary Add-on", then select any file in the extension's directory.
  • In Chrome: Open the chrome://extensions page, click load unpacked, and then select the folder in which the manifest.json file exists.
  • After that, in your website, press F12, and navigate to panel "NetworkSpinner", and add target URLs(support certain wildcard pattern, separate each url on a new line), choose relevant checkbox or input.
  • Always keep the devtool window opened while using(regardless which panel tab in view), then refresh the website page to check the effect.
  • NOTE: If you close the devtool window, all settings will be removed and back to normal.

Inputs

  • delaySec delayType work together with delay checkbox for delaying request.delaySec is the time in second for the delay.
  • delayType.before hold the request in browser end before sending the request down to the network. (Support both Firefox and Chrome)
  • delayType.after immediately sends the request down to the network BUT hold its response data(if any) for delaySec time before releasing data to the browser engine. (Support only in Firefox)
  • block checkbox is for blocking the request.

At last, thanks Xu Zong for this idea.

network-spinner-devtool's People

Contributors

gaoqing avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

network-spinner-devtool's Issues

Suggestion: Add support to add randomized delays to requests

To aid in debugging race conditions, it would be beneficial to be able to vary a request's delay.

For example, three requests made one after the other could be resolved in any order rather than always finishing in the order they were made.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.