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

Ktor Client JS: request to /example requests http://localhost/example #1695

Open
Ribesg opened this issue Mar 2, 2020 · 5 comments
Open
Assignees
Labels

Comments

@Ribesg
Copy link
Contributor

Ribesg commented Mar 2, 2020

Ktor Version and Engine Used (client or server and name)
Ktor Client Common 1.3.1, in browser (JS)

Describe the bug
request to /example requests http://localhost/example

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/Ribesg/Kita/tree/2c7941183ebcde1fc2193bd00a1bed53f1249b10 on a machine which can be reached from the network (a server)
    git clone https://github.com/Ribesg/Kita
    cd Kita
    git reset --hard 2c7941183ebcde1fc2193bd00a1bed53f1249b10
    
  2. Run ./runServer.sh
  3. Browse to https://yourserver:12345
  4. Try to login using whatever credentials (correct ones are admin/admin)
  5. See failing requests to https://localhost/api/auth/login instead of https://yourserver:12345/api/auth/login in the console

Expected behavior
Requests should use the current location.origin when none is provided in the browser

@Ribesg Ribesg added the bug label Mar 2, 2020
@e5l e5l self-assigned this Mar 2, 2020
@e5l
Copy link
Member

e5l commented Mar 2, 2020

Hi @Ribesg, thanks for the report. I'll be fixed in the next minor release

@SebastianAigner
Copy link
Contributor

For anyone else looking, this bug is still present in 1.3.2. :)

@oleg-larshin
Copy link

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

@Stexxe
Copy link
Contributor

Stexxe commented Jun 24, 2021

I can still reproduce it using Ktor 1.6.0 when running a development server with the following code:

GlobalScope.launch {
     val client = HttpClient(Js)
     val r = client.get<String>("/example")
}

@Stexxe Stexxe reopened this Jun 24, 2021
@Benjoyo
Copy link

Benjoyo commented Mar 6, 2022

Any updates? Still present in 1.6.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants