twitst4tz

twitter statistics web application
Log | Files | Refs | README | LICENSE

http.js (954B)


      1 const handler = {
      2     scheme: "http",
      3     domainHost: true,
      4     parse: function (components, options) {
      5         //report missing host
      6         if (!components.host) {
      7             components.error = components.error || "HTTP URIs must have a host.";
      8         }
      9         return components;
     10     },
     11     serialize: function (components, options) {
     12         //normalize the default port
     13         if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
     14             components.port = undefined;
     15         }
     16         //normalize the empty path
     17         if (!components.path) {
     18             components.path = "/";
     19         }
     20         //NOTE: We do not parse query strings for HTTP URIs
     21         //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
     22         //and not the HTTP spec.
     23         return components;
     24     }
     25 };
     26 export default handler;
     27 //# sourceMappingURL=http.js.map