support api baasic auth + fix erronous reference to res code
Merge pull request #4 from piavlo/feature/api-basic-auth

support api baasic auth + fix erronous reference to res code