HTTP: added TSTR validation flag to the rewrite option.

This is to improve error messages for rewrite configuration.
Take the configuration as an example:

  {
      "rewrite": "`${a + "
  }

Previously, when applying it the user would see this error message:

  failed to apply previous configuration

After this change, the user will see this improved error message:

  the previous configuration is invalid: "SyntaxError: Unexpected end of input in default:1" in the "rewrite" value.
This commit is contained in:
Zhidao HONG 2023-12-11 10:46:58 +08:00
parent 88854cf146
commit 49aee6760a

View file

@ -690,6 +690,7 @@ static nxt_conf_vldt_object_t nxt_conf_vldt_action_common_members[] = {
{
.name = nxt_string("rewrite"),
.type = NXT_CONF_VLDT_STRING,
.flags = NXT_CONF_VLDT_TSTR,
},
{
.name = nxt_string("response_headers"),