Check header existance without case

41 Views Asked by At

Is there a better way to check headers without case in Mountebank imposters other than below approach (using or condition)

{
  "responses": [
    {
      "inject": "<%- stringify(filename, 'Scripts/MyDept/CutOffTime.ejs') %>"
    }
  ],
  "predicates": [
        {
          "and": [
                   {
                    "or": [
                      {
                        "exists": {
                          "headers": {
                            "client-id": true
                          }
                        }
                      },
                      {
                        "exists": {
                          "headers": {
                            "Client-Id": true
                          }
                        }
                      }
                    ]
                  },
            {
              "matches": {
                "method": "GET",
                "path": "/cutoff-times",
                "headers": {
                  "X-CLIENT-ID": "^[ A-Za-z0-9]*$"
                },
                "query": {
                  "country": "\\w+"
                  }
              }
            }
          ]
        }
      ]
0

There are 0 best solutions below