membrane / api-gateway

API gateway for REST, OpenAPI, GraphQL and SOAP written in Java.
https://membrane-api.io
Apache License 2.0
457 stars 137 forks source link

setHeader uses proprietary templating for SpEL #1055

Closed t-burch closed 4 months ago

t-burch commented 5 months ago

The setHeader interceptor uses ${<SpEL>} as its template for SpEL expressions, but why not use the actual #{<SpEL>} template so it integrates with the SpEL context given in the proxies.xml file?

predic8 commented 4 months ago

Good point. We have lots of samples, we should therefore move slowy. @t-burch can you support both #{} and ${}. Can you also rewrite the setHeader examples?

In 6.0.0 we can remove the support for ${}.

t-burch commented 4 months ago

After further analysis, it might not actually be possible to extend the default spel context, because the ExchangeEvaluationContext requires an exchange object, whilst the default spel context is initialised on startup.

t-burch commented 4 months ago

No examples use setHeader at the moment, so the only task would be to remove $ once 6.0 rolls out