Skip to content

Conversation

@EndangeredMassa
Copy link
Contributor

@EndangeredMassa EndangeredMassa commented Jun 22, 2021

When using pretender, I'll sometimes see or write localhost and 127.0.0.1 in the same app. It would be handy if these were normalized to the same value.

Here's a stab at it, but I don't mind if there's a better approach. Feel free to close if this isn't worth the trouble.


I added a test, updated some existing tests, and made sure yarn test-ci still passes.

@xg-wang
Copy link
Member

xg-wang commented Jul 25, 2021

Hmmm they do not seem to be exactly the same, at least for the tests being modified. I tried window.location.host and they will differentiate the localhost vs 127.0.0.1.

I think a better place is

let host = parseURL(url).host;
where we can normalize. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants