Headers parser mixin function to be implemented with elements that parses HTTP headers.
The mixing is being deprecated and implementation should move to use HeadersParser
module instead.
npm install --save @advanced-rest-client/headers-parser-mixin
import * as HeadersParser from '@advanced-rest-client/headers-parser-mixin';
const errorMessage = HeadersParser.getError('Whitespace Name: x-true');
import { LitElement, html } from 'lit-element';
import { HeadersParserMixin } from '@advanced-rest-client/headers-parser-mixin';
class SampleElement extends HeadersParserMixin(LitElement) {
render() {
const validation = this.getHeaderError('Whitespace Name: x-true');
return html`
${validation ? html`<p>${validation}<p>` : html`<p>Headers are valid</p>`}
`;
}
}
customElements.define('sample-element', SampleElement);
git clone https://github.com/advanced-rest-client/headers-parser-mixin
cd headers-parser-mixin
npm install
npm start
npm test