joepie91 / node-bhttp

A sane HTTP client library for Node.js with Streams2 support.
62 stars 12 forks source link

Missing protocol should raise descriptive error #14

Open joepie91 opened 9 years ago

joepie91 commented 9 years ago

Currently, when specifying an invalid URL without a defined protocol (eg. bhttp.get("google.com")), an error like the following occurs (personal details removed):

Unhandled rejection TypeError: Cannot read property 'length' of null
    at S.endsWith (C:\Users\x\Documents\website\node_modules\bhttp\node_modules\string\lib\string.js:167:24)
    at S.chompRight (C:\Users\x\Documents\website\node_modules\bhttp\node_modules\string\lib\string.js:104:16)
    at C:\Users\x\Documents\website\node_modules\bhttp\lib\bhttp.js:183:47

This should raise a more descriptive error instead, indicating that the protocol is missing.

myndzi commented 8 years ago

:+1:

Similar for other missing parts such as the hostname

stevenvachon commented 8 years ago

Duplicate of #4