How to use the caseless function in caseless

To help you get started, we’ve selected a few caseless examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codemanki / cloudscraper / docs / examples / unsupported-requester.js View on Github external
constructor (options) {
    super();
    const self = this;

    self.uri = typeof options.uri === 'string'
      ? new URL(options.uri) : options.uri;

    // Use options.headers instead of `this.headers` if serializing
    self.headers = caseless(options.headers);

    // Cloudscraper will only call `request.callback` for the very last request
    self.callback = options.callback;

    // The actual request should be performed at this point.
    // Pseudo error event
    const error = null;
    if (error) {
      self.emit('error', new Error('Request error'));
    }

    // Pseudo response arguments
    const body = Buffer.from('Response content', 'utf-8');
    const status = 200;
    const headers = {
      // Response headers
github groupon / quinn / node_modules / quinn.respond / src / response.js View on Github external
constructor(props, isResolved) {
    this.statusCode = props.statusCode || 200;
    this.headers = caseless(props.headers || {});
    this.body = props.body || null; // null === empty body

    this._isResolved = !!isResolved;
  }
github codemanki / cloudscraper / docs / examples / unsupported-requester.js View on Github external
constructor (headers, statusCode, body) {
    this.headers = headers;
    this.caseless = caseless(headers);
    this.statusCode = statusCode;
    this.body = body;
  }
}

caseless

Caseless object set/get/has, very useful when working with HTTP headers.

Apache-2.0
Latest version published 7 years ago

Package Health Score

71 / 100
Full package analysis

Popular caseless functions