improve specs, work on error handling

I changed from baseUrl to endpoint to be consistent, because we call it endpoint elsewhere.