debian-forge-composer/internal/jobqueue
Lars Karlitski 8ef4db816d jobqueue/api: return errors as JSON
The API is always advertising a content type of application/json, but
not sending JSON on errors.

Change it to send simple JSON objects like this:

    { "message": "something went wrong" }

This can be extended to include more structured information in the
future.

Also return an (for now) empty JSON object from `addJobHandler()`. It
returned nothing before, which is invalid JSON.

Stop testing for the actual error strings in `api_test.go`. These are
meant for humans and can change. Only check what a client could
meaningfully check for, which is only the HTTP status code right now.
2020-04-06 19:51:36 +02:00
..
api.go jobqueue/api: return errors as JSON 2020-04-06 19:51:36 +02:00
api_test.go jobqueue/api: return errors as JSON 2020-04-06 19:51:36 +02:00
client.go jobqueue/api: return errors as JSON 2020-04-06 19:51:36 +02:00
json.go jobqueue/api: return errors as JSON 2020-04-06 19:51:36 +02:00