-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support removal of headers via filters #8699
Comments
We cannot distinguish between null and undefined - due to how java bridge works. But we can allow removal of headers by treating as null/undefined as removal in
Note that Java Servlet API allows to remove headers exactly the same way - by specifying |
After the fix
|
If any key has an undefined value in the header in an XP response object - commonly used ones like
ETag
orCache-Control
, but also seemingly any key at all, such aspleaseDontFail
- will cause an error when trying to return it from a controller. This is only reported as a pretty genericWebError: null
orNullPointerException
.Tested in webapp.js and a service, for example with this code:
Letting
pleaseDontFail
be any generic string works, as in, passes unnoticed. Also works ifpleaseDontFail
is undefined outside ofheaders
, for example in the response root as a sibling ofbody
.Such a generic error message is a bit problematic IMO.
undefined
is a pretty commonplace JS practice. It doesn't usually cause errors like this elsewhere in XP, and will in many cases be expected to behave similarly to if the attribute hadn't been added at all. In this case, not adding it is different than having it with anundefined
value.pleaseDontFail
attribute won't be shown (except by explicitly loggingObject.keys(response.headers)
).I suggest adding a catch and error message.
Example error dump:
The text was updated successfully, but these errors were encountered: