Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Custom error templates only work with APIs that are not tracked #438

@lonelycode

Description

@lonelycode

Do you want to request a feature or report a bug?
bug

What is the current behavior?
Using a custom error template error_401.json does not return the custom error unless the API has "do_not_track": true set.

What is the expected behavior?
The gateway should respond with custom errors regardless of the tracking status of the API Definition.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

  1. Create a custom error template error_403.json in templates:
{
  "custom_error": "YOU SHALL NOT PASS!"
} 
  1. Create a new API that uses token authentication

  2. Access that API with a non-existent token:

curl -X GET -H "Authorization: Foo" -H "Content-Type: application/json" http://10.0.75.2:8181/test/get
  1. Check the error that gets returned, it will be the dfault template, not your custom one.

Which versions of Tyk affected by this issue? Did this work in previous versions of Tyk?
2.2

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions