Last change
on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
959 bytes
|
Line | |
---|
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 | const secure = String(components.scheme).toLowerCase() === "https";
|
---|
13 | //normalize the default port
|
---|
14 | if (components.port === (secure ? 443 : 80) || components.port === "") {
|
---|
15 | components.port = undefined;
|
---|
16 | }
|
---|
17 | //normalize the empty path
|
---|
18 | if (!components.path) {
|
---|
19 | components.path = "/";
|
---|
20 | }
|
---|
21 | //NOTE: We do not parse query strings for HTTP URIs
|
---|
22 | //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
|
---|
23 | //and not the HTTP spec.
|
---|
24 | return components;
|
---|
25 | }
|
---|
26 | };
|
---|
27 | export default handler;
|
---|
28 | //# sourceMappingURL=http.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.