handler.go 585 B

1234567891011121314151617181920212223242526272829303132
  1. package landing
  2. import (
  3. _ "embed"
  4. "net/http"
  5. "github.com/imgproxy/imgproxy/v3/httpheaders"
  6. "github.com/imgproxy/imgproxy/v3/server"
  7. )
  8. //go:embed body.html
  9. var landingBody []byte
  10. // Handler handles landing requests
  11. type Handler struct{}
  12. // New creates new handler object
  13. func New() *Handler {
  14. return &Handler{}
  15. }
  16. // Execute handles the landing request
  17. func (h *Handler) Execute(
  18. reqID string,
  19. rw server.ResponseWriter,
  20. req *http.Request,
  21. ) error {
  22. rw.Header().Set(httpheaders.ContentType, "text/html")
  23. rw.WriteHeader(http.StatusOK)
  24. rw.Write(landingBody)
  25. return nil
  26. }