Simple code straight from documentation returns ERR_EMPTY_RESPONSE
See original GitHub issueUsing 0.9.3 (current version) I tried the following simple code from the documentation:
fun main(args: Array<String>) {
val s = embeddedServer(Netty, port = 8080) {
routing {
get("/") {
call.respondText("Hello World!", ContentType.Text.Plain)
}
get("/demo") {
call.respondText("HELLO WORLD!")
}
}
}
s.start(wait = true)
}
When I run this code I see:
238 [main] INFO ktor.application - No ktor.deployment.watch patterns specified, automatic reload is not active
290 [main] INFO ktor.application - Responding at http://0.0.0.0:8080
When I visit http://localhost:8080/ in my browser I get ERR_EMPTY_RESPONSE. Adding a println() at the beginning of the get("/")
block reveals that it doesn’t seem to be executing any of that code at all.
I’m currently using ktor in a separate project which doesn’t suffer from this problem - I’ve got no idea what’s different between one and the other. Would appreciate any ideas.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:19 (5 by maintainers)
Top Results From Across the Web
Simple code straight from documentation returns ... - GitHub
When I visit http://localhost:8080/ in my browser I get ERR_EMPTY_RESPONSE. Adding a println() at the beginning of the get("/") block reveals that it ......
Read more >How to Fix the ERR_EMPTY_RESPONSE Chrome Error (Full ...
ERR_EMPTY_RESPONSE is a web browser error that can appear in Chrome and Chromium-based web browsers, such as Microsoft Edge or Opera. It means ......
Read more >How To Fix the "ERR_EMPTY_RESPONSE" Error (5 Potential ...
This error is often caused by connectivity issues, such as a poor internet connection or problems with the server itself. It can also...
Read more >Getting ERR_EMPTY_RESPONSE on $.POST - Stack Overflow
The code works well on all pages except message.php where the user message is posted and fetched multiple times with $.post (used to...
Read more >ERR_EMPTY_RESPONSE | 8 Ways to Fix It
The "ERR_EMPTY_RESPONSE" error may be caused by files stored in the "Temp" folder in Windows. To remove these files, press the Windows key...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
http://0.0.0.0:8080
can’t be accessed, 127.0.0.1:8080 canJust FYI - my workaround was to use Jetty instead of Netty.