Skip to content

Commit 0f6eaaa

Browse files
committed
remove the payload
1 parent bef452f commit 0f6eaaa

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

http/handler/handler.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/portainer/agent/http/proxy"
2424
"github.com/portainer/agent/http/security"
2525
kubecli "github.com/portainer/agent/kubernetes"
26+
"github.com/rs/zerolog/log"
2627
)
2728

2829
// Handler is the main handler of the application.
@@ -100,6 +101,8 @@ func (h *Handler) ServeHTTP(rw http.ResponseWriter, request *http.Request) {
100101
}
101102
rw.Header().Set(agent.HTTPResponseAgentPlatform, strconv.Itoa(int(agentPlatformIdentifier)))
102103

104+
log.Debug().Msgf("Handling request: %s %s", request.Method, request.URL.Path)
105+
103106
switch {
104107
case strings.HasPrefix(request.URL.Path, "/v1"):
105108
h.ServeHTTPV1(rw, request)

http/handler/handlerv2.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ package handler
33
import (
44
"net/http"
55
"strings"
6+
7+
"github.com/rs/zerolog/log"
68
)
79

810
// ServeHTTPV2 is the HTTP router for all v2 api requests.
911
func (h *Handler) ServeHTTPV2(rw http.ResponseWriter, request *http.Request) {
12+
13+
log.Debug().Msgf("Request: %s %s", request.Method, request.URL.Path)
14+
1015
switch {
1116
case strings.HasPrefix(request.URL.Path, "/v2/ping"):
1217
http.StripPrefix("/v2", h.pingHandler).ServeHTTP(rw, request)

http/handler/kubernetes/kubernetes_namespaces.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,26 @@ import (
55
"net/http"
66

77
httperror "github.com/portainer/portainer/pkg/libhttp/error"
8-
"github.com/portainer/portainer/pkg/libhttp/request"
98
"github.com/portainer/portainer/pkg/libhttp/response"
9+
"github.com/rs/zerolog/log"
1010
)
1111

12-
type getNamespacePayload struct{}
12+
// type getNamespacePayload struct{}
1313

14-
func (payload *getNamespacePayload) Validate(r *http.Request) error {
14+
// func (payload *getNamespacePayload) Validate(r *http.Request) error {
1515

16-
return nil
17-
}
16+
// return nil
17+
// }
1818

1919
func (handler *Handler) kubernetesGetNamespaces(rw http.ResponseWriter, r *http.Request) *httperror.HandlerError {
20-
var payload getNamespacePayload
21-
err := request.DecodeAndValidateJSONPayload(r, &payload)
22-
if err != nil {
23-
return httperror.BadRequest("Invalid request payload", err)
24-
}
20+
21+
log.Debug().Msgf("GetNamespaces Handler: Request: %s %s", r.Method, r.URL.Path)
22+
23+
// var payload getNamespacePayload
24+
// err := request.DecodeAndValidateJSONPayload(r, &payload)
25+
// if err != nil {
26+
// return httperror.BadRequest("Invalid request payload", err)
27+
// }
2528

2629
for _, header := range r.Header {
2730
for _, value := range header {

0 commit comments

Comments
 (0)