support api baasic auth + fix erronous reference to res code

for the unfortunate noes that use basic http auth for the sensu api