Closed dekadentno closed 4 years ago
I can try to resolve this and submit a pull request, but I am not sure why the port would be mandatory in the first place, maybe there's a reason but I don't see it.
Hi @dekadentno
Just use the baseURL
option
http: {
baseURL: 'https://bla.bla.com/v1'
}
Hi @dekadentno Just use the
baseURL
optionhttp: { baseURL: 'https://bla.bla.com/v1' }
Hi @ricardogobbosouza I've tried that. Also not possible because it automatically adds the default port (3000) at the end of the baseURL. Check line 20 here: https://github.com/nuxt/http/blob/dev/lib/module.js
The options are overwritten, see https://github.com/nuxt/http/blob/dev/lib/module.js#L38
The options are overwritten, see https://github.com/nuxt/http/blob/dev/lib/module.js#L38
I understand what you are trying to say, but I still get the default port at the end of my baseURL on every request. My nuxt.config.js
looks just like the one you wrote in your comment.
Edit: I'll make a repo with my problem this weekend.
@dekadentno I await the Repo
I agree with @ricardogobbosouza to use baseURL to override. But could be also nice enhancenment to omit the port if is matching scheme (https/443 http/80)
Thank you for your answers and your time @ricardogobbosouza @pi0
I am very ashamed but I have to let you know that the source of my problems was in my baseUrl
because the currect spelling is baseURL
😅 I noticed that right now while trying to reproduce my problem in a separate repo so I can upload it for you guys.
I hope my mistake will help some future lurkers because I spent more than a week on this issue in vain.
@dekadentno Actually nothing to sorry and thanks for report. I saw baseUrl
misspelling multiple times. It is not module bug but a DX bug that we should handle properly. Will push fix for both :)
What problem does this feature solve?
The port should be optional because there are many public (and non public) APIs that don't require the port in the Request URL.
What does the proposed changes look like?
In
nuxt.config.js
it should be possible to do