How to use the content-type.format function in content-type

To help you get started, we’ve selected a few content-type 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 onehilltech / blueprint / packages / blueprint-gatekeeper / src / server / node_modules / express / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
  if (!type || !charset) {
    return type;
  }

  // parse type
  var parsed = contentType.parse(type);

  // set charset
  parsed.parameters.charset = charset;

  // format type
  return contentType.format(parsed);
};
github codeforgeek / node-session / node_modules / express / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
  if (!type || !charset) {
    return type;
  }

  // parse type
  var parsed = contentType.parse(type);

  // set charset
  parsed.parameters.charset = charset;

  // format type
  return contentType.format(parsed);
};
github senchalabs / connect / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
  if (!type || !charset) return type;

  var parsed = contentType.parse(type);
  var exists = parsed.parameters.charset;

  // keep existing charset
  if (exists) {
    return type;
  }

  // set charset
  parsed.parameters.charset = charset;

  return contentType.format(parsed);
};
github TheBroox / TextAdventure.js / node_modules / express / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
  if (!type || !charset) {
    return type;
  }

  // parse type
  var parsed = contentType.parse(type);

  // set charset
  parsed.parameters.charset = charset;

  // format type
  return contentType.format(parsed);
};
github ifgyong / demo / React-native / Helloword / node_modules / connect / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
    if (!type || !charset) return type;

    var parsed = contentType.parse(type);
    var exists = parsed.parameters.charset;

    // keep existing charset
    if (exists) {
        return type;
    }

    // set charset
    parsed.parameters.charset = charset;

    return contentType.format(parsed);
};
github smhg / gettext-parser / lib / pocompiler.js View on Github external
Compiler.prototype._handleCharset = function () {
  const ct = contentType.parse(this._table.headers['Content-Type'] || 'text/plain');

  const charset = sharedFuncs.formatCharset(this._table.charset || ct.parameters.charset || 'utf-8');

  // clean up content-type charset independently using fallback if missing
  if (ct.parameters.charset) {
    ct.parameters.charset = sharedFuncs.formatCharset(ct.parameters.charset);
  }

  this._table.charset = charset;
  this._table.headers['Content-Type'] = contentType.format(ct);
};
github andrewvy / slack-pongbot / node_modules / express / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
  if (!type || !charset) {
    return type;
  }

  // parse type
  var parsed = contentType.parse(type);

  // set charset
  parsed.parameters.charset = charset;

  // format type
  return contentType.format(parsed);
};
github david-mark-llc / jessie / builder / node_modules / express / lib / utils.js View on Github external
exports.setCharset = function setCharset(type, charset) {
  if (!type || !charset) {
    return type;
  }

  // parse type
  var parsed = contentType.parse(type);

  // set charset
  parsed.parameters.charset = charset;

  // format type
  return contentType.format(parsed);
};

content-type

Create and parse HTTP Content-Type header

MIT
Latest version published 1 year ago

Package Health Score

72 / 100
Full package analysis

Popular content-type functions