-
Hello, Here I talk about consumption of user defined route (not the Admin or Control API).
At least this is the case for key-auth plugin, consumer-restriction plugin... Even if i change my Accept header the content type stay text/plain. Is it a bug ? Maybe the default content type should be application/json ? or even better take care of the accept header ? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Can you describe it in more detail? |
Beta Was this translation helpful? Give feedback.
-
Step 1
Step 2 Try to consume the route without being identified to raise an error
Response is :
The Content-Type header should be : application/json as it is in fact a Json in response. This issue is not on "consumer-restriction"plugin only, it also happen for the key-auth plugin when you provide a wrong key, and i guess it is a general plugin behavior.
i expect a response like
In case of unknow accept or not managed, here we go for text/plain :
Response should be something like :
|
Beta Was this translation helpful? Give feedback.
-
Issue #8511 |
Beta Was this translation helpful? Give feedback.
-
A work around for this is to do something like the following assuming all responses from your API are JSON. global_rules:
- id: error_response_json
plugins:
response-rewrite:
_meta:
filter: [
[
"status",
">=",
400
]
]
headers:
set:
"Content-Type": "application/json; charset=utf-8" |
Beta Was this translation helpful? Give feedback.
Issue #8511