a zip code crypto-currency system good for red ONLY

headers.js 815B

123456789101112131415161718192021222324252627282930313233343536
  1. 'use strict';
  2. var Headers = function() {
  3. this.clear();
  4. };
  5. Headers.prototype.ALLOWED_DUPLICATES = ['set-cookie', 'set-cookie2', 'warning', 'www-authenticate'];
  6. Headers.prototype.clear = function() {
  7. this._sent = {};
  8. this._lines = [];
  9. };
  10. Headers.prototype.set = function(name, value) {
  11. if (value === undefined) return;
  12. name = this._strip(name);
  13. value = this._strip(value);
  14. var key = name.toLowerCase();
  15. if (!this._sent.hasOwnProperty(key) || this.ALLOWED_DUPLICATES.indexOf(key) >= 0) {
  16. this._sent[key] = true;
  17. this._lines.push(name + ': ' + value + '\r\n');
  18. }
  19. };
  20. Headers.prototype.toString = function() {
  21. return this._lines.join('');
  22. };
  23. Headers.prototype._strip = function(string) {
  24. return string.toString().replace(/^ */, '').replace(/ *$/, '');
  25. };
  26. module.exports = Headers;