12345678910111213141516171819202122232425262728 |
- const handler = {
- scheme: "http",
- domainHost: true,
- parse: function (components, options) {
-
- if (!components.host) {
- components.error = components.error || "HTTP URIs must have a host.";
- }
- return components;
- },
- serialize: function (components, options) {
- const secure = String(components.scheme).toLowerCase() === "https";
-
- if (components.port === (secure ? 443 : 80) || components.port === "") {
- components.port = undefined;
- }
-
- if (!components.path) {
- components.path = "/";
- }
-
-
-
- return components;
- }
- };
- export default handler;
|