diff --git a/README.md b/README.md index 2656d47..77deea7 100644 --- a/README.md +++ b/README.md @@ -279,11 +279,11 @@ There is a REST API for clients to checkout and return items from one or more po ### Checkout -`PUT /checkout/{pool}` checks out an instance from the given pool and returns +`POST /checkout/{pool}` checks out an instance from the given pool and returns that instance's parameters: ```sh -$ curl -s -XPUT localhost:6000/checkout/postgres | jq +$ curl -s -XPOST localhost:6000/checkout/postgres | jq { "id":"8482c266192f013346d03f71b2aa6d4b647909e3502ac525039bdd0fe9fcac30", "hostname":"localhost", @@ -304,10 +304,10 @@ $ curl -s -XDELETE localhost:6000/return/postgres/8482c266192f013346d03f71b2aa6d ### Batch Checkout -`PUT /checkout` checks out an instance from every configured pool. +`POST /checkout` checks out an instance from every configured pool. ```sh -$ curl -s -XPUT localhost:6000/checkout | tee checkout.json | jq +$ curl -s -XPOST localhost:6000/checkout | tee checkout.json | jq { "postgres": { "id": "2dedf5dbe9cc8d7a0cd71ed75455c7310db79aea44925562b82c01b959d85e7e", diff --git a/net/client.go b/net/client.go index 2d97d9a..f39a3a9 100644 --- a/net/client.go +++ b/net/client.go @@ -43,7 +43,7 @@ func (b *ClientBuilder) Create() (*Client, error) { func (c *Client) CheckoutBatch(names ...string) (params.Set, error) { ps := params.Set{} - req, err := http.NewRequest("PUT", c.url(rpcCheckoutPath), &bytes.Buffer{}) + req, err := http.NewRequest("POST", c.url(rpcCheckoutPath), &bytes.Buffer{}) if err != nil { return ps, err } @@ -64,7 +64,7 @@ func (c *Client) CheckoutBatch(names ...string) (params.Set, error) { func (c *Client) Checkout(name string) (params.Params, error) { params := params.Params{} - req, err := http.NewRequest("PUT", c.url(rpcCheckoutPath, name), &bytes.Buffer{}) + req, err := http.NewRequest("POST", c.url(rpcCheckoutPath, name), &bytes.Buffer{}) if err != nil { return params, err } diff --git a/net/server.go b/net/server.go index eb05194..81883cb 100644 --- a/net/server.go +++ b/net/server.go @@ -57,9 +57,9 @@ func (sb *ServerBuilder) Create() (*Server, error) { r := mux.NewRouter() r.HandleFunc(rpcCheckoutPath, server.handleCheckoutBatch). - Methods("PUT") + Methods("POST") r.HandleFunc(rpcCheckoutPath+"/{pool}", server.handleCheckoutPool). - Methods("PUT") + Methods("POST") r.HandleFunc(rpcReturnPath, server.handleReturnBatch). Headers("Content-Type", rpcContentType).