1 import { URISchemeHandler, URIComponents, URIOptions } from "../uri";
3 const handler:URISchemeHandler = {
8 parse : function (components:URIComponents, options:URIOptions):URIComponents {
10 if (!components.host) {
11 components.error = components.error || "HTTP URIs must have a host.";
17 serialize : function (components:URIComponents, options:URIOptions):URIComponents {
18 //normalize the default port
19 if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
20 components.port = undefined;
23 //normalize the empty path
24 if (!components.path) {
25 components.path = "/";
28 //NOTE: We do not parse query strings for HTTP URIs
29 //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
30 //and not the HTTP spec.
36 export default handler;