allow customizing request options globally and per host
remove unnecessary semicolon
inline local variable used only once
add extra error reporting diagnostics