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

Dev Tools should support PATCH method #2343

Open
peternied opened this issue Sep 13, 2022 · 2 comments
Open

Dev Tools should support PATCH method #2343

peternied opened this issue Sep 13, 2022 · 2 comments
Labels
bug Something isn't working console help wanted Community development is encouraged needs research

Comments

@peternied
Copy link
Member

Reproduction:

  • Find some documentation about a scenario in OpenSearch APIs that use a PATCH command, like
  • Get excited to try it out in your own cluster
  • Open Dashboards, login as an admin user
  • Navigate to Dev Tools
  • Paste the following into the console window
PATCH _plugins/_security/api/roles/my_role
[
  {
    "op": "replace", "path": "/index_permissions/0/fls", "value": ["myfield1", "myfield2"]
  },
  {
    "op": "remove", "path": "/index_permissions/0/dls"
  }
]
  • Select that text and hit the 'send request' button

Expected:

The request should succeed

Actual:

An error message appears in the response window:

{"statusCode":400,"error":"Bad Request","message":"[request query.method]: Method must be one of, case insensitive ['HEAD', 'GET', 'POST', 'PUT', 'DELETE']. Received 'PATCH'."}

Be sad you can't use this great tool to vet the scenario called out in the documentation

@peternied peternied added bug Something isn't working untriaged labels Sep 13, 2022
@peternied
Copy link
Member Author

FYI @cwillum

@BSFishy
Copy link
Contributor

BSFishy commented Sep 20, 2022

It seems that the request method simply isn't in the list here:

validate: (method) => {
return ['HEAD', 'GET', 'POST', 'PUT', 'DELETE'].some(
(verb) => verb.toLowerCase() === method.toLowerCase()
)
? undefined
: `Method must be one of, case insensitive ['HEAD', 'GET', 'POST', 'PUT', 'DELETE']. Received '${method}'.`;
},

Something else of note is that it looks like the website doesn't recognize PATCH methods either, which would most likely be an issue with code somewhere else.

Just by changing that, though, the error is just propagated through to Open Search, which ends up here:

https://github.com/opensearch-project/OpenSearch/blob/2bfe8b31af354e5d00e4ac67d544ce664f083934/server/src/main/java/org/opensearch/rest/RestController.java#L490-L506

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working console help wanted Community development is encouraged needs research
Projects
None yet
Development

No branches or pull requests

4 participants