Skip to content

Commit

Permalink
agent: align /agent/join with reality
Browse files Browse the repository at this point in the history
/agent/join uses PUT instead of GET as documented.
  • Loading branch information
magiconair committed Aug 19, 2017
1 parent ea2facc commit a90783f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions agent/agent_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ func (s *HTTPServer) AgentMembers(resp http.ResponseWriter, req *http.Request) (
}

func (s *HTTPServer) AgentJoin(resp http.ResponseWriter, req *http.Request) (interface{}, error) {
if req.Method != "GET" {
return nil, MethodNotAllowedError{req.Method, []string{"GET"}}
if req.Method != "PUT" {
return nil, MethodNotAllowedError{req.Method, []string{"PUT"}}
}

// Fetch the ACL token, if any, and enforce agent policy.
Expand Down
2 changes: 1 addition & 1 deletion agent/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ func TestHTTPAPI_MethodNotAllowed(t *testing.T) {
{"GET", "/v1/agent/check/warn/"}, // GET ??
{"GET", "/v1/agent/checks"},
{"PUT", "/v1/agent/force-leave/"},
{"GET", "/v1/agent/join/"},
{"PUT", "/v1/agent/join/"},
{"PUT", "/v1/agent/leave"},
{"PUT", "/v1/agent/maintenance"},
{"GET", "/v1/agent/metrics"},
Expand Down
2 changes: 1 addition & 1 deletion website/source/api/agent.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ This endpoint instructs the agent to attempt to connect to a given address.

| Method | Path | Produces |
| ------ | ---------------------------- | -------------------------- |
| `GET` | `/agent/join/:address` | `application/json` |
| `PUT` | `/agent/join/:address` | `application/json` |

The table below shows this endpoint's support for
[blocking queries](/api/index.html#blocking-queries),
Expand Down

0 comments on commit a90783f

Please sign in to comment.