Reputation: 3
I have a spring boot application. When I make a call to the application, I send a header named X-ID. I have a read only library in my application which has a filter that validates the header that if it is a valid UUID.This gets invoked automatically even before the call reaches the controller. I want to make sure that X-ID should be allowed to have any string as its value and not only UUID.So, when I send any string as X-ID then it should accept and not throw 400 error.How can I do this? Please help me with this.
I tried creating a custom filter and customHeaderValidator for this. So that is working fine. The string value is passed through the customValidator without throwing the error but then originalHeaderValidator gets invoked and it throws the error. The original Header Validator is always getting invoked. So, how can I solve this problem.
Is there any way I can override the validator and stop its invocation from read-only library?
Upvotes: 0
Views: 52
Reputation: 161
Yes, there are multiple ways you can achieve this. But first of all if this is read only lib then it must be holding that filter for a specific purpose. Don't you think you are trying to defy the purpose behind the validation filter?
What's the purpose / aim behind implementing such logic or custom validator?
Upvotes: 0