Sha256: 99f6f2c5a0bb07195a72e48d7b40b4823644f25422e3e153a00cc0e46df8c644

Contents?: true

Size: 946 Bytes

Versions: 91

Compression:

Stored size: 946 Bytes

Contents

import { URISchemeHandler, URIComponents, URIOptions } from "../uri";

const handler:URISchemeHandler = {
	scheme : "http",

	domainHost : true,

	parse : function (components:URIComponents, options:URIOptions):URIComponents {
		//report missing host
		if (!components.host) {
			components.error = components.error || "HTTP URIs must have a host.";
		}

		return components;
	},

	serialize : function (components:URIComponents, options:URIOptions):URIComponents {
		//normalize the default port
		if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
			components.port = undefined;
		}
		
		//normalize the empty path
		if (!components.path) {
			components.path = "/";
		}

		//NOTE: We do not parse query strings for HTTP URIs
		//as WWW Form Url Encoded query strings are part of the HTML4+ spec,
		//and not the HTTP spec.

		return components;
	}
};

export default handler;

Version data entries

91 entries across 91 versions & 11 rubygems

Version Path
disco_app-0.18.0 test/dummy/node_modules/uri-js/src/schemes/http.ts
disco_app-0.18.2 test/dummy/node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.6 node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.5 node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.4 node_modules/uri-js/src/schemes/http.ts
disco_app-0.16.1 test/dummy/node_modules/uri-js/src/schemes/http.ts
disco_app-0.15.2 test/dummy/node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.3 node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.2 node_modules/uri-js/src/schemes/http.ts
disco_app-0.18.4 test/dummy/node_modules/uri-js/src/schemes/http.ts
disco_app-0.18.1 test/dummy/node_modules/uri-js/src/schemes/http.ts
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/uri-js/src/schemes/http.ts
disco_app-0.14.0 test/dummy/node_modules/uri-js/src/schemes/http.ts
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.1 node_modules/uri-js/src/schemes/http.ts
trusty-cms-4.3.5 node_modules/uri-js/src/schemes/http.ts
trusty-cms-5.0.0 node_modules/uri-js/src/schemes/http.ts
trusty-cms-4.3.4 node_modules/uri-js/src/schemes/http.ts
trusty-cms-4.3.3 node_modules/uri-js/src/schemes/http.ts
trusty-cms-4.3.2 node_modules/uri-js/src/schemes/http.ts