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

SpEL Evaluation -> Accessing Properties that do not exist causes "not indexable" exception #1039

Closed t-burch closed 5 months ago

t-burch commented 5 months ago

When accessing headers or properties like: "headers['X-Api-Key']", Membrane will throw a SpelEvaluationException "Indexing into type '...SpEL...' is not supported" How should membrane handle this? Ignoring/Returning False would be best maybe

Example config:

<if test="headers['X-Test-Header'] matches '.*bar.*'" language="SpEL">
                    <groovy>System.out.println("X-Test-Header does contain bar!")</groovy>
                    <return />
                </if>