From JsonPatch in ASP.NET Core web API I have understood if I send the following description in a patch request
[
{ "op": "test", "path": "/a/b/c", "value": "foo" },
{ "op": "replace", "path": "/a/b/c", "value": "dummy" }
]
the replace operation should only be performed if the current value for /a/b/c equal to 'foo' (rfc6902).
However, I have currently the problem that I would like to test if /a/b/c has the value 'foo' OR 'bar' and if true then process the replace action. I want to avoid that the client has to send the request twice, one time with { "op": "test", "path": "/a/b/c", "value": "foo" } and if this fails { "op": "test", "path": "/a/b/c", "value": "bar" }. Is there a nice way to achieve that?
Aucun commentaire:
Enregistrer un commentaire