Hi, I'm experimenting with the Contract Module and I'd like to add Security Headers like Cache-Control, X-Content-Type-Options to my responses.
RouteMetaDsl.headers seems to be for Requests and I am wondering if I even should do this via the contract or just compose a Filter that adds those headers with the Contract before returning my RoutingHttpHandler?
d
dave
11/01/2023, 3:44 PM
We don't support the response headers in the OpenAPI description of the response right now.
To actually add the headers, you can use a Filter, but this will not add those headers to the description
o
Oliver Eisenbarth
11/01/2023, 4:02 PM
Thank you very much! I'd like to know, if there's a rationale behind not supporting them?
d
dave
11/01/2023, 4:02 PM
nope - it's just not done. I think it came in with V3 and shouldn't be too hard to add at some point
o
Oliver Eisenbarth
11/01/2023, 4:20 PM
Great, thanks for the fast reply.
BTW it's a great module, easily discoverable and well documented, too.
So much better than writing YAML and generating code from it imho. 😊
d
dave
11/01/2023, 4:22 PM
Yep - of course, one of the real bonuses is that you don't have to maintain 1000s of lines of that YAML - which (like most manual docs) is out-of-date within about 10 minutes of it being written anyway 😉