We are facing problems when using the following function inside the "Execute Javascript assertion":
resp1 = context.getOrCreateMessageVariable ('request');
requestBody = resp1.getContent();
When there are special characters in the payload like accents or 'ñ'; it automatically replaces them with the '?' symbol.
We need to make transformation with the different payloads allowing special characters and not replacing it with '?' characters. Can you help us?
You can try with this payload:
Release : 9.4
Component : API GATEWAY
The solution is to add Content-Type header with value "application/json" when sending the request.
When the Content-Type header is application/json, I can see the special characters correctly. I tried with the payload in the description and the longer payload in one of the comments
If you send something like Content-Type: text/plain, you will see the question marks
Above solution didn't seem to work in this use case scenario; however, add Content-Type header with value "application/javascript" and it worked!
Furthermore,
1. Add LANG environment variable when starting the container gateway: LANG=en_US.UTF-8 (docker-compose for example has a way to define environment variables in docker-compose file)
- This should start the container gateway with the en_US.UTF-8 locale instead of POSIX
2. Use Content-Type application/json