Azure function proxy response body cannot include values within curly braces

210 Views Asked by At

I have configured an Azure function app and added a proxy function to mock an API endpoint.

The response body of this mocked endpoint includes regular expressions however the quantifiers in the regular expressions are being removed as the proxy function expects values within curly braces {} to be variables.

This is example of the response body that I have configured for the proxy function on the Azure portal:

{ "RegularExpression":"RegExpThenQuantifer{1,4}" }

However when I hit the endpoint this is what I get back:

{"RegularExpression":"RegExpThenQuantifer"}

Notice the {1,4} has been removed as it thinks it is null. Does anyone know a way to escape curly braces and let me return the quantifiers as they are?

1

There are 1 best solutions below

0
On

Azure function host is based on .net framework(v1)/.net standard(v2), so just use double curly braces to escape itself which is universal in C#/.NET environment.

For example { "RegularExpression":"RegExpThenQuantifer{{1,4}}" } will return you { "RegularExpression":"RegExpThenQuantifer{1,4}" } as expected.

Just in case you might be curious, Azure function doesn't support RegExp match on API endpoint yet.