https://github.com/maritzstl/mtz-ajax-interceptor
A group of elements to support intercepting ajax requests for injecting headers or handling responses globally.
https://github.com/maritzstl/mtz-ajax-interceptor
injecting-headers interceptor polymer web-components
Last synced: over 1 year ago
JSON representation
A group of elements to support intercepting ajax requests for injecting headers or handling responses globally.
- Host: GitHub
- URL: https://github.com/maritzstl/mtz-ajax-interceptor
- Owner: MaritzSTL
- License: mit
- Created: 2017-06-22T20:36:36.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-12-20T16:59:14.000Z (over 7 years ago)
- Last Synced: 2025-01-13T14:31:55.443Z (over 1 year ago)
- Topics: injecting-headers, interceptor, polymer, web-components
- Language: HTML
- Homepage: https://www.webcomponents.org/element/MaritzSTL/mtz-ajax-interceptor
- Size: 343 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/MaritzSTL/mtz-ajax-interceptor)
[](https://www.webcomponents.org/element/MaritzSTL/mtz-ajax-interceptor)
# \
A group of elements to support intercepting ajax requests for injecting headers, url rewriting or handling responses globally.
## Elements
### ``
An implementation of `mtz-ajax-interceptor-behavior` useful for quick implementations, ie. demos. This allows other interceptors to be slotted in.
### ``
An implementation of the mtz.InterceptorBehavior that injects auth headers based on the event.target containing the [with-auth] attribute.
### `` [Deprecated use ``]
An implementation of the mtz.InterceptorBehavior that globally sets the withCredentials option based on the local `withCredentials` property.
### ``
An implementation of the mtz.InterceptorBehavior that injects a header:value onto a presend event for iron-ajax.
### ``
An implementation of the mtz.InterceptorBehavior that compares a status property against the status code in the event to determine if the interceptor logic should run or not.
### ``
An implementation of the mtz.InterceptorBehavior that rewrites matching requests request url to a new url onto a presend event for iron-ajax.
## Behaviors
### `mtz.AjaxInterceptor`
Handles registering declarative interceptors then listening for all registered events and calling the interceptors associated with those events.
### `mtz.Interceptor`
Used to create an instance of an interceptor that allows for declarative registration for binding logic to a bubbling event that is not a child of the element.
## Install the Polymer-CLI
First, make sure you have the [Polymer CLI](https://www.npmjs.com/package/polymer-cli) installed. Then run `polymer serve` to serve your element locally.
## Viewing Your Element
```
$ polymer serve
```
## Running Tests
```
$ polymer test
```
Your application is already set up to be tested via [web-component-tester](https://github.com/Polymer/web-component-tester). Run `polymer test` to run your application's test suite locally.