Skip to content

[Beta] Ensure client REST requests are not lost in event of catastrophic failure / early program termination. Demo is in the link.

License

Notifications You must be signed in to change notification settings

tehtea/persisted-requests

Repository files navigation

Persisted Requests

Maintenance made-with-javascript License: GPL v3

demo gif

This library allows REST requests to be made from a client without the original context of the request becoming lost in the event the user moves away from the website, or if the page crashes.

This is done by persisting each request in storage before it is sent out. By default, the request then gets removed from storage after it is fulfilled by the server.

Installation Steps

Using NPM: npm install --save persisted-requests

Using Yarn: yarn add persisted-requests

Supported Environments

  • Firefox
  • Chrome
  • Safari

See the browsers section of karma.conf.js for the list of browsers for which tests were ran on.

Supported Persistence Types

  • LocalStorage
  • In-Memory

Supported REST Client

Only Axios is supported for now, future support for other clients will be contingent on the usage of this library.

Unsupported / Untested Request Features

  • Cookies
  • The following Request Body types:
    • XPath
    • XML
    • XML Schema
    • JSON Schema
    • regular expression
    • plain text

Testing

Only end-to-end testing was done for now due to the relative small size of this project. See the tests folder for them.

The tests can be run by calling npm run test. Karma was used with Jasmine to run them in the browser, with Jasmine-Ajax used for capturing the requests sent using an XMLHTTPRequest() spy.

Make sure to set "declaration": false in tsconfig.json before running tests. This is a tech debt to clean up.

Demo

The demo app contains example usage for this library, and also demonstrates what it does under the hood.

About

[Beta] Ensure client REST requests are not lost in event of catastrophic failure / early program termination. Demo is in the link.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published