mcustiel / phiremock-common

Common classes for Phiremock
GNU General Public License v3.0
3 stars 4 forks source link

Bug report: correct regexp could give InvalidArgumentException #8

Closed webarchitect609 closed 3 years ago

webarchitect609 commented 3 years ago

Hello! This night I got this bug

InvalidArgumentException : Invalid regular expression received: /.*/i

for this v1 expectation

{
  "scenarioName": "Proxy all the rest queries on stub",
  "request": {
    "url": {
      "isEqualTo" : "/orders/dryRun"
    },
    "body": {
      "matches": "/.*/i"
    }
  },
  "proxyTo": "https://example.com",
  "priority" : 0
}

And I don't like it, cause /.*/i is a correct regexp, although it's a bit strange. So I made this tiny small PR #7 to fix it once and forever. It also alters the message of the InvalidArgumentException, making something like that:

Invalid regular expression received: `/.*`, preg error #1

It would be honor for me if you consider it good and merge it. Thank you!

mcustiel commented 3 years ago

Good point. I completely forgot about the modifiers. Thank you for reporting and fixing it.