main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100755
|
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.