question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Applying defaults with a base URL

See original GitHub issue

https://github.com/kenchris/urlpattern-polyfill/blob/3b7dde94e60b9353bd54328c8b61078175a2c816/src/url-pattern.ts#L68-L73

I’m not sure if i misunderstood or this is a bug/awkwardness, but essentially:

(new URLPattern({pathname: '/foo'})).pattern;
// produces:
{
  "hash": "*",
  "hostname": "*",
  "password": "*",
  "pathname": "/foo",
  "port": "*",
  "protocol": "*",
  "search": "*",
  "username": "*"
}

(new URLPattern({pathname: '/foo', baseURL})).pattern;
// produces:
{
  "hash": "",
  "hostname": "",
  "password": "",
  "pathname": "/foo",
  "port": "",
  "protocol": "",
  "search": "",
  "username": ""
}

this means the computed regex patterns become ^$ in the latter, rather than ^(.*)$.

so we can’t rely on defaults if we have a base URL? the comment i quoted seems to hint at the fact that its on purpose, but it feels like the behaviour should be the same to me

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
wanderviewcommented, Jul 28, 2021

By the way, this discussion might be better as a https://github.com/WICG/urlpattern spec issue.

0reactions
wanderviewcommented, Aug 17, 2021

@kenchris I think this can probably be closed unless you want to update some documentation within this repo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Setting baseURL in default configuration · Issue #175 - GitHub
To resolve this I think the defaults should be passed to the Axios constructor for the axios instance. Then change to axios.defaults =...
Read more >
How to set default baseUrl - javascript - Stack Overflow
I'm using RequireJS, and all my modules reside in /payloads/backend/application .
Read more >
SEO URLs / Set default application for request domain (base url)
I'm looking to specify one of our applications as the default site for prod. I've set up a site rule with the base...
Read more >
Config Defaults | Axios Docs
You can specify config defaults that will be applied to every request. Global axios defaults. axios.defaults.baseURL = 'https://api.example ...
Read more >
Understand Default URL Pattern - Contentstack
Understand Default URL Pattern. In Contentstack, the URL is the location of your web property. It is made up of two parts: Base...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found