Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Matching Request method with isOneOf #1434

Open
rahilb opened this issue Mar 15, 2021 · 3 comments
Open

Feature Request: Matching Request method with isOneOf #1434

rahilb opened this issue Mar 15, 2021 · 3 comments

Comments

@rahilb
Copy link

rahilb commented Mar 15, 2021

Motivation:

I want to stub and endpoint that may be called with multiple methods without duplication. E.g. there is an endpoint /foo/{id} which supports PUT and POST requests.

As far as I can tell with JSON mappings there is no way to do this currently; there is only the ANY matcher which is too coarse.

Proposal:

Introduce a syntax similar to all the other matchers for request method, for example:

{
  "priority": 1,
  "name": "test",
  "request": {
    "urlPattern": "/foo/\\S+",
    "method": {
      "isOneOf" : ["POST", "PUT"]
     }
  },
  "response": {
    "status": 204
  }
}

If it's a good idea I'm happy to try and contribute this but it might take me a while!

@tomakehurst
Copy link
Member

It might be simpler to make method take either a string or array of strings, the latter to support this case e.g.

{
  "request": {
    "urlPath": "/foo",
    "method": ["POST", "PUT"]
  },
  "response": {
    "status": 204
  }
}

@Saimurugeshwari
Copy link

can I contribute this issue?

@oleg-nenashev oleg-nenashev added the hacktoberfest Hacktoberfest label Oct 5, 2023
@KimBartikowski5337
Copy link

Can this issue be closed due to the merge of #1734?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants