We want to use Kong to put in front of our API’s. Our API’s use a specific format for reporting errors to the API-users.
I’ve noticed that the response format from the plugins isn’t following any general line.
e.g. the OAuth plugin returns
{
"error_description": "The access token is missing",
"error": "invalid_request"
}
and the rate limiting plugin returns:
{
"message": "API rate limit exceeded"
}
I would like these messages to be unified, and to follow my internal structure (makes it easier to parse for clients).
My internal structure, just for the sake of it:
{
status: 429,
message: "API rate limit exceeded",
code: ECODEINTEXT
}
I would like to know if there is an easy way to customize the error messages of the plugins, without having to create all custom versions of the plugins.