Why a configured base URL cannot be used, or undefined. Checked in this
order (the first problem is reported):
it must parse as an absolute URL;
the scheme must be http(s). The default transport also gates the scheme per
hop, but the engine is exported as a library and may be handed a custom
transport that does no such check;
no query or fragment: request paths are appended to the base URL as a
string, so http://h/?x=1 would request /?x=1/api/v1/... and http://h/#f
would request /;
a % in the user name or password must start a valid escape (%25 for a
literal one): the userinfo is decoded for the Authorization header;
no surrounding whitespace and no whitespace or control character inside.
new URL() trims the first and drops tab/CR/LF inside, but the engine
appends paths to the raw string, so "https://h " would request
https://h /api/v1/...;
the path must not end in /api/v1, which the client appends itself
(/api/v1/api/v1/... is a 404).
The reason never echoes the value: a base URL may carry a password.
Why a configured base URL cannot be used, or
undefined. Checked in this order (the first problem is reported):http://h/?x=1would request/?x=1/api/v1/...andhttp://h/#fwould request/;%in the user name or password must start a valid escape (%25for a literal one): the userinfo is decoded for the Authorization header;new URL()trims the first and drops tab/CR/LF inside, but the engine appends paths to the raw string, so"https://h "would requesthttps://h /api/v1/...;/api/v1, which the client appends itself (/api/v1/api/v1/...is a 404).The reason never echoes the value: a base URL may carry a password.