[Geoserver-devel] [jira] Created: (GEOS-3946) Updating a coveragestore via REST returns 201 rather than 200

Updating a coveragestore via REST returns 201 rather than 200
-------------------------------------------------------------

                 Key: GEOS-3946
                 URL: http://jira.codehaus.org/browse/GEOS-3946
             Project: GeoServer
          Issue Type: Bug
          Components: REST
    Affects Versions: 2.0.1
         Environment: Mac OSX 10.5 : Darwin rutabaga 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
Centos 4.8 : Linux dev-1-web1 2.6.18-164.15.1.el5.028stab068.9 #1 SMP Tue Mar 30 18:07:38 MSD 2010 x86_64 x86_64 x86_64 GNU/Linux
            Reporter: Alex Dean
            Assignee: Andrea Aime

When I update an existing coverage store, I expect a PUT to return a 200 response as described in the API documentation :
Instead, the REST service returns a 201 response.

First, I create a coveragestore via POST. 201 response is as expected.

$ curl -v -XPOST --basic --user admin:geoserver -H 'Content-Type: application/xml' -d '<coverageStore><name>radar_sample</name><workspace>leads</workspace><enabled>true</enabled></coverageStore>' http://localhost:8080/geoserver/rest/workspaces/leads/coveragestores
* About to connect() to localhost port 8080 (#0)
* Trying ::1... Connection refused
* Trying fe80::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
* Server auth using Basic with user 'admin'

POST /geoserver/rest/workspaces/leads/coveragestores HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.20.0 (i386-apple-darwin9.8.0) libcurl/7.20.0 OpenSSL/0.9.8n zlib/1.2.4 libidn/1.16
Host: localhost:8080
Accept: */*
Content-Type: application/xml
Content-Length: 107

< HTTP/1.1 201 Created
< Date: Wed, 05 May 2010 20:22:24 GMT
< Location: http://localhost:8080/geoserver/rest/workspaces/leads/coveragestores/radar_sample
< Server: Noelios-Restlet-Engine/1.0..8
< Transfer-Encoding: chunked
<
* Connection #0 to host localhost left intact
* Closing connection #0

Next... update the coverage store via PUT. Server returns 201 rather than the expected (and documented) 200. This is incorrect since nothing new has been 'created'.

$ curl -v -XPUT --basic --user admin:geoserver -H 'Content-type: text/plain' -d 'file:/Users/alex/radar_sample.tif' http://localhost:8080/geoserver/rest/workspaces/leads/coveragestores/radar_sample/external.geotiff?configure=first\\&amp;coverageName=radar\_sample
* About to connect() to localhost port 8080 (#0)
* Trying ::1... Connection refused
* Trying fe80::1... Connection refused
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
* Server auth using Basic with user 'admin'

PUT /geoserver/rest/workspaces/leads/coveragestores/radar_sample/external.geotiff?configure=first&coverageName=radar_sample HTTP/1.1
Authorization: Basic YWRtaW46Z2Vvc2VydmVy
User-Agent: curl/7.20.0 (i386-apple-darwin9.8.0) libcurl/7.20.0 OpenSSL/0.9.8n zlib/1.2.4 libidn/1.16
Host: localhost:8080
Accept: */*
Content-type: text/plain
Content-Length: 33

< HTTP/1.1 201 Created
< Date: Wed, 05 May 2010 20:23:37 GMT
< Server: Noelios-Restlet-Engine/1.0..8
< Content-Type: application/xml
< Transfer-Encoding: chunked
<
<coverageStore>
  <name>radar_sample</name>
  <type>GeoTIFF</type>
  <enabled>true</enabled>
  <workspace>
    <name>leads</name>
    <href>http://localhost:8080/geoserver/rest/workspaces/WorkspaceInfoImpl--7a1d8d2c:12817857b4f:-8000.xml&lt;/href&gt;
  </workspace>
  <url>file:/Users/alex/radar_sample.tif</url>
  <coverages>
    <atom:link xmlns:atom="http://www.w3.org/2005/Atom&quot; rel="alternate" href="http://localhost:8080/geoserver/rest/workspaces/leads/coveragestores/radar_sample/external/coverages.xml&quot; type="application/xml"/>
  </coverages>
* Connection #0 to host localhost left intact
* Closing connection #0

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira