http#STATUS_CODES JavaScript Examples

The following examples show how to use http#STATUS_CODES. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.es.js    From ipfs-action with MIT License 6 votes vote down vote up
constructor(body = null, opts = {}) {
    Body.call(this, body, opts);
    this.url = opts.url;
    this.status = opts.status || 200;
    this.statusText = opts.statusText || STATUS_CODES[this.status];
    this.headers = new Headers(opts.headers);
    this.useElectronNet = opts.useElectronNet;
    Object.defineProperty(this, Symbol.toStringTag, {
      value: 'Response',
      writable: false,
      enumerable: false,
      configurable: true
    });
  }
Example #2
Source File: index.es.js    From Lynx with MIT License 6 votes vote down vote up
constructor() {
		let body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
		let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

		Body.call(this, body, opts);

		const status = opts.status || 200;

		this[INTERNALS$1] = {
			url: opts.url,
			status,
			statusText: opts.statusText || STATUS_CODES[status],
			headers: new Headers(opts.headers)
		};
	}