Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getRequestURL function not working properly #952

Open
catfishlty opened this issue Jan 14, 2025 · 2 comments
Open

getRequestURL function not working properly #952

catfishlty opened this issue Jan 14, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@catfishlty
Copy link

catfishlty commented Jan 14, 2025

Environment

  • NodeJS: v23.5.0
  • "nuxt": "^3.15.0",
  • "vue": "latest",
  • "h3": "^1.13.0"

Reproduction

API

export default defineEventHandler(async (event) => {
  const url = getRequestURL(event);
  console.log(url)
  return ""
});

Call Url: http://localhost:30301/api/v1/system

URL { href: 'http://localhost/api/v1/system',
  origin: 'http://localhost',
  protocol: 'http:',
  username: '',
  password: '',
  host: 'localhost',
  hostname: 'localhost',
  port: '',
  pathname: '/api/v1/system',
  search: '',
  searchParams: URLSearchParams {},
  hash: '' }

Describe the bug

The value of url.host should be localhost:30301 instead of localhost.
So I think getRequestURL function is not working correctly.
Could you like help me check it?

Additional context

No response

Logs

No response

@catfishlty catfishlty added the bug Something isn't working label Jan 14, 2025
@cjpearson
Copy link
Contributor

In this case the port should also be in href, origin and port right?

@catfishlty
Copy link
Author

In this case the port should also be in href, origin and port right?

Yes, I think so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants