How to use the webidl-conversions.ByteString function in webidl-conversions

To help you get started, we’ve selected a few webidl-conversions 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 sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
setRequestHeader(header, value) {
      const flag = this[xhrSymbols.flag];
      const properties = this[xhrSymbols.properties];

      if (arguments.length !== 2) {
        throw new TypeError("2 arguments required for setRequestHeader");
      }
      header = conversions.ByteString(header);
      value = conversions.ByteString(value);

      if (this.readyState !== XMLHttpRequest.OPENED || properties.send) {
        throw new DOMException("The object is in an invalid state.", "InvalidStateError");
      }

      value = normalizeHeaderValue(value);

      if (!tokenRegexp.test(header) || !fieldValueRegexp.test(value)) {
        throw new DOMException("The string did not match the expected pattern.", "SyntaxError");
      }

      const lcHeader = header.toLowerCase();

      if (forbiddenRequestHeaders.has(lcHeader) || lcHeader.startsWith("sec-") || lcHeader.startsWith("proxy-")) {
        return;
github zubairghori / Ultimate_todo_list / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
setRequestHeader(header, value) {
      const flag = this[xhrSymbols.flag];
      const properties = this[xhrSymbols.properties];

      if (arguments.length !== 2) {
        throw new TypeError("2 arguments required for setRequestHeader");
      }
      header = conversions.ByteString(header);
      value = conversions.ByteString(value);

      if (this.readyState !== XMLHttpRequest.OPENED || properties.send) {
        throw new DOMException("The object is in an invalid state.", "InvalidStateError");
      }

      value = normalizeHeaderValue(value);

      if (!tokenRegexp.test(header) || !fieldValueRegexp.test(value)) {
        throw new DOMException("The string did not match the expected pattern.", "SyntaxError");
      }

      const lcHeader = header.toLowerCase();

      if (forbiddenRequestHeaders.has(lcHeader) || lcHeader.startsWith("sec-") || lcHeader.startsWith("proxy-")) {
        return;
github flaviuse / mern-authentication / client / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
setRequestHeader(header, value) {
      const flag = this[xhrSymbols.flag];
      const properties = this[xhrSymbols.properties];

      if (arguments.length !== 2) {
        throw new TypeError("2 arguments required for setRequestHeader");
      }
      header = conversions.ByteString(header);
      value = conversions.ByteString(value);

      if (this.readyState !== XMLHttpRequest.OPENED || properties.send) {
        throw new DOMException("The object is in an invalid state.", "InvalidStateError");
      }

      value = normalizeHeaderValue(value);

      if (!tokenRegexp.test(header) || !fieldValueRegexp.test(value)) {
        throw new DOMException("The string did not match the expected pattern.", "SyntaxError");
      }

      const lcHeader = header.toLowerCase();

      if (forbiddenRequestHeaders.has(lcHeader) || lcHeader.startsWith("sec-") || lcHeader.startsWith("proxy-")) {
        return;
      }
github flaviuse / mern-authentication / client / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
open(method, uri, asynchronous, user, password) {
      if (!this._ownerDocument) {
        throw new DOMException("The object is in an invalid state.", "InvalidStateError");
      }
      const flag = this[xhrSymbols.flag];
      const properties = this[xhrSymbols.properties];
      const argumentCount = arguments.length;
      if (argumentCount < 2) {
        throw new TypeError("Not enough arguments (expected at least 2)");
      }

      method = conversions.ByteString(method);
      uri = conversions.USVString(uri);
      if (user) {
        user = conversions.USVString(user);
      }
      if (password) {
        password = conversions.USVString(password);
      }

      if (!tokenRegexp.test(method)) {
        throw new DOMException("The string did not match the expected pattern.", "SyntaxError");
      }
      const upperCaseMethod = method.toUpperCase();
      if (forbiddenRequestMethods.has(upperCaseMethod)) {
        throw new DOMException("The operation is insecure.", "SecurityError");
      }
github jsdom / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
getResponseHeader(header) {
      const properties = this[xhrSymbols.properties];
      const { readyState } = this;
      if (readyState === XMLHttpRequest.UNSENT || readyState === XMLHttpRequest.OPENED) {
        return null;
      }
      const lcHeader = conversions.ByteString(header).toLowerCase();
      if (properties.filteredResponseHeaders.find(filtered => lcHeader === filtered.toLowerCase())) {
        return null;
      }
      return getResponseHeader(this, lcHeader);
    }
github flaviuse / mern-authentication / client / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
getResponseHeader(header) {
      const properties = this[xhrSymbols.properties];
      const { readyState } = this;
      if (readyState === XMLHttpRequest.UNSENT || readyState === XMLHttpRequest.OPENED) {
        return null;
      }
      const lcHeader = conversions.ByteString(header).toLowerCase();
      if (properties.filteredResponseHeaders.find(filtered => lcHeader === filtered.toLowerCase())) {
        return null;
      }
      return getResponseHeader(this, lcHeader);
    }
github zubairghori / Ultimate_todo_list / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
getResponseHeader(header) {
      const properties = this[xhrSymbols.properties];
      const { readyState } = this;
      if (readyState === XMLHttpRequest.UNSENT || readyState === XMLHttpRequest.OPENED) {
        return null;
      }
      const lcHeader = conversions.ByteString(header).toLowerCase();
      if (properties.filteredResponseHeaders.find(filtered => lcHeader === filtered.toLowerCase())) {
        return null;
      }
      return getResponseHeader(this, lcHeader);
    }
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
getResponseHeader(header) {
      const properties = this[xhrSymbols.properties];
      const { readyState } = this;
      if (readyState === XMLHttpRequest.UNSENT || readyState === XMLHttpRequest.OPENED) {
        return null;
      }
      const lcHeader = conversions.ByteString(header).toLowerCase();
      if (properties.filteredResponseHeaders.find(filtered => lcHeader === filtered.toLowerCase())) {
        return null;
      }
      return getResponseHeader(this, lcHeader);
    }
github flaviuse / mern-authentication / client / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
        .map(key => [conversions.ByteString(key).toLowerCase(), properties.responseHeaders[key]].join(": "))
        .join("\r\n");
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / xmlhttprequest.js View on Github external
        .map(key => [conversions.ByteString(key).toLowerCase(), properties.responseHeaders[key]].join(": "))
        .join("\r\n");

webidl-conversions

Implements the WebIDL algorithms for converting to and from JavaScript values

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

68 / 100
Full package analysis