bbyars / mountebank

Over the wire test doubles
http://www.mbtest.org
MIT License
2k stars 262 forks source link

GET imposter(s) with `replayable: true` does not return `allowCORS` property #760

Open teameh opened 5 months ago

teameh commented 5 months ago

Expected behaviour

Note that https server metadata such as key , cert ,mutualAuth, etc. Are already returned because server.metadata is already added to the result. It's just that allowCORS is missing.

Actual behaviour

allowCORS field is missing

Steps to reproduce

PUT http://localhost:2525/imposters

{
  "imposters": [
    {
      "port": 1234,
      "protocol": "https",
      "allowCORS": true
    }
  ]
}

GET http://localhost:2525/imposters

{
  "imposters": [
    {
      "protocol": "http",
      "port": 1234,
      "recordRequests": false,
      "stubs": []
    }
  ]
}

Expected would be :

{
  "imposters": [
    {
      "protocol": "http",
      "port": 1234,
      "allowCORS" : true,
      "recordRequests": false,
      "stubs": []
    }
  ]
}

Software versions used

OS         : MacOS
mountebank : v2.9.1
node.js    : v16.20.2
Installation method : npm

Log contents in mb.log when running mb --loglevel debug


warn: [mb:2525] Running with --allowInjection set. See http://localhost:2525/docs/security for security info
info: [mb:2525] mountebank v2.9.1 now taking orders - point your browser to http://localhost:2525/ for help
debug: [mb:2525] config: {"options":{"allow-injection":true,"allowInjection":true,"local-only":true,"localOnly":true,"port":2525,"noParse":false,"no-parse":false,"formatter":"mountebank-formatters","pidfile":"mb.pid","ipWhitelist":["*"],"ip-whitelist":"*","mock":false,"debug":false,"protofile":"protocols.json","origin":false,"apikey":null,"log":{"level":"debug","transports":{"console":{"colorize":true,"format":"%level: %message"},"file":{"path":"mb.log","format":"json"}}}},"process":{"nodeVersion":"v16.20.2","architecture":"arm64","platform":"darwin"}}
info: [mb:2525] PUT /imposters
debug: [mb:2525] ::ffff:127.0.0.1:50003 => {"imposters":[{"port":1234,"protocol":"http","allowCORS":true}]}
info: [http:1234] Open for business...
info: [mb:2525] GET /imposters?replayable=true&removeProxies=false```