Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/uri-js/dist/esnext/schemes/http.js')
-rw-r--r--node_modules/uri-js/dist/esnext/schemes/http.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/node_modules/uri-js/dist/esnext/schemes/http.js b/node_modules/uri-js/dist/esnext/schemes/http.js
new file mode 100644
index 000000000..a28036988
--- /dev/null
+++ b/node_modules/uri-js/dist/esnext/schemes/http.js
@@ -0,0 +1,27 @@
+const handler = {
+ scheme: "http",
+ domainHost: true,
+ parse: function (components, options) {
+ //report missing host
+ if (!components.host) {
+ components.error = components.error || "HTTP URIs must have a host.";
+ }
+ return components;
+ },
+ serialize: function (components, options) {
+ //normalize the default port
+ if (components.port === (String(components.scheme).toLowerCase() !== "https" ? 80 : 443) || components.port === "") {
+ components.port = undefined;
+ }
+ //normalize the empty path
+ if (!components.path) {
+ components.path = "/";
+ }
+ //NOTE: We do not parse query strings for HTTP URIs
+ //as WWW Form Url Encoded query strings are part of the HTML4+ spec,
+ //and not the HTTP spec.
+ return components;
+ }
+};
+export default handler;
+//# sourceMappingURL=http.js.map \ No newline at end of file