While trying to hit REST API by providing with necessary security credentials , the response is retrieved as 500-Internal Server Error. The log trace is been notes as ,
Expression value is invalid. Specified value has invalid Control characters. (or) Expression value is invalid. Specified value has invalid CRLF characters.
This is not happening always but happens for few hits of the REST API particularly for few callers. Any idea/suggestion over here?
Note: https call only. The REST API call is made via Azure APIM with policy code.
CodePudding user response:
This error Specified value has invalid CRLF characters
means, you have invalid control characters in the response header.
This happens for few users as they send Cyrillic chars in the response. Those characters are replaced with some valid characters as work around in APIM policy file.
You can use json.decode(utf8.decode(r.bodyBytes))
to decode Cyrillic chars in the response body.
You can refer to Latin and cyrillic letters not showing in Http response body, How to send cyrillic / finish characters in http header and How to fix wrong cyrillic characters in httpclient response