Skip to content

Commit

Permalink
api: put -> post
Browse files Browse the repository at this point in the history
  • Loading branch information
boz committed Apr 26, 2017
1 parent 5947b2e commit fe6b1ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions net/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions net/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down

0 comments on commit fe6b1ad

Please sign in to comment.