payment gateway for rpn cn
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

35 lignes
767B

  1. package main
  2. import (
  3. "net/http"
  4. )
  5. type NotFoundRedirectRespWr struct {
  6. http.ResponseWriter // We embed http.ResponseWriter
  7. status int
  8. }
  9. func (w *NotFoundRedirectRespWr) WriteHeader(status int) {
  10. w.status = status // Store the status for our own use
  11. if status != http.StatusNotFound {
  12. w.ResponseWriter.WriteHeader(status)
  13. }
  14. }
  15. func (w *NotFoundRedirectRespWr) Write(p []byte) (int, error) {
  16. if w.status != http.StatusNotFound {
  17. return w.ResponseWriter.Write(p)
  18. }
  19. return len(p), nil // Lie that we successfully written it
  20. }
  21. func wrapHandler(h http.Handler) http.HandlerFunc {
  22. return func(w http.ResponseWriter, r *http.Request) {
  23. if r.URL.Path == "/" {
  24. leanworkInP2P(w, r) // StartPay(w, r)
  25. } else {
  26. h.ServeHTTP(w, r)
  27. }
  28. }
  29. }