Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

http.js 959B

12345678910111213141516171819202122232425262728
  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