jeffbski / wait-on

wait-on is a cross-platform command line utility and Node.js API which will wait for files, ports, sockets, and http(s) resources to become available
MIT License
1.87k stars 77 forks source link

Parse Error: Expected HTTP on localhost #155

Open tomasz-zukowski opened 8 months ago

tomasz-zukowski commented 8 months ago

Hello, I'm facing some issue after updating from v6.0.0 to v7.2.0. Trying to run wait-on by defining scripts in npm in my angular project:

"scripts": {
    "test:accessibility": "npm-run-all -p -r start check-accessibility",
    "check-accessibility": "wait-on http://localhost:4600/ && hint --debug http://localhost:4600",
}

The server was starting, but nothing more was heppening. I used --verbose parameter and here is the errors I've got:

making HTTP(S) head request to url:http://localhost:4600/ ... HTTP(S) error for http://localhost:4600/ Error: Parse Error: Expected HTTP/

As mentioned it was working well on v6.0.0. I also noticed that when I use 127.0.0.1 instead of localhost then it works well.

image

janbrasna commented 5 months ago

This may be caused by either axios update or node update — TL;DR chances are your localhost resolves to IPv6 and your server does listen only on IPv4 so using 127.0.0.1 is the safest bet.

Maybe duplicate of: