简体   繁体   中英

How to create multiple imposters in mountebank?

I am new to mountebank and i seeing if i can create multiple imposters in a single post request?

i am using the following request

{
  "imposters": [
    {
      "port": 5150,
      "protocol": "http",
      "recordRequests": true,
      "_links": {
        "self": {
          "href": "http://localhost:2525/imposters/5150"
        }
      }
    },
    {
      "port": 5151,
      "protocol": "http",
      "recordRequests": true,
       "_links": {
        "self": {
          "href": "http://localhost:2525/imposters/5151"
        }
      }
    }
  ]
}

and i am getting an error from mountebank

{
    "errors": [
        {
            "code": "bad data",
            "message": "'protocol' is a required field"
        }
    ]
}

Can anyone help me if i am missign something here?

I suspect the problem is you're using the wrong HTTP method. The way to do that would be to use the PUT command to /imposters instead of POST. See https://www.mbtest.org/docs/api/overview#put-imposters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM