Added tests and error handling

Added unit tests and error handling for bitly status codes in body.