Skip to content

Commit

Permalink
Fix Ngrok Tunnel Proxy (dnsge#6)
Browse files Browse the repository at this point in the history
Write a 200 with a body of `OK` instead of 204 with no body
  • Loading branch information
dnsge authored Mar 28, 2023
1 parent bbcafc4 commit 941874a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (s *SubHandler) checkIfDuplicate(w http.ResponseWriter, r *http.Request, h
if s.OnDuplicateNotification != nil {
go s.OnDuplicateNotification(h)
}
writeEmpty(w) // ignore and return 2XX code
writeEmptyOK(w) // ignore and return 2XX code
return true, nil
}
}
Expand Down Expand Up @@ -529,11 +529,11 @@ func (s *SubHandler) handleNotification(w http.ResponseWriter, bodyBytes []byte,
return
}

writeEmpty(w)
writeEmptyOK(w)
}

// Writes a 204 No Content with Content-Length: 0 response
func writeEmpty(w http.ResponseWriter) {
w.Header().Set("Content-Length", "0")
w.WriteHeader(http.StatusNoContent)
// Writes a 200 OK response
func writeEmptyOK(w http.ResponseWriter) {
w.WriteHeader(http.StatusOK)
_, _ = w.Write([]byte("OK"))
}

0 comments on commit 941874a

Please sign in to comment.