Galder Zamarreño created ISPN-11059:
---------------------------------------
Summary: Improve cache already exists HTTP code
Key: ISPN-11059
URL:
https://issues.redhat.com/browse/ISPN-11059
Project: Infinispan
Issue Type: Enhancement
Affects Versions: 10.1.0.CR1
Reporter: Galder Zamarreño
Assignee: Tristan Tarrant
Creating a cache that already exists currently returns {{400 Bad Request}}:
{code}
curl -v -d '<infinispan><cache-container><distributed-cache
name="example" mode="SYNC"><backups><backup
site="SiteB" strategy="ASYNC"
timeout="30000"/></backups></distributed-cache></cache-container></infinispan>'
-H "Content-Type: application/xml" -u developer:$(kubectl get secret
example-infinispan-generated-secret -o jsonpath="{.data.identities\.yaml}" |
base64 -D | yq -r .credentials[0].password) -X POST $(minikube service
example-infinispan-external --url --namespace local-operators)/rest/v2/caches/example
Note: Unnecessary use of -X or --request, POST is already inferred.
* Trying 192.168.99.101...
* TCP_NODELAY set
* Connected to 192.168.99.101 (192.168.99.101) port 30222 (#0)
* Server auth using Basic with user 'developer'
POST /rest/v2/caches/example HTTP/1.1
Host: 192.168.99.101:30222
Authorization: Basic ZGV2ZWxvcGVyOlFXUWE4U3V0c0QzZW9SUmg=
User-Agent: curl/7.64.1
Accept: */*
Content-Type: application/xml
Content-Length: 200
* upload completely sent off: 200 out of 200 bytes
< HTTP/1.1 400 Bad Request
< content-length: 40
<
* Connection #0 to host 192.168.99.101 left intact
ISPN000507: Cache example already exists* Closing connection 0
{code}
More fine-grained behaviour would be desirable: if the cache being created is exactly the
same configuration wise, it should return 200. Otherwise, if different it should be 409.
--
This message was sent by Atlassian Jira
(v7.13.8#713008)