mirror of
https://github.com/stefanprodan/podinfo.git
synced 2026-05-06 01:27:05 +00:00
v0.0.9 release
- added echo headers handler
This commit is contained in:
@@ -61,6 +61,20 @@ func (s *Server) echo(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) echoHeaders(w http.ResponseWriter, r *http.Request) {
|
||||
d, err := yaml.Marshal(r.Header)
|
||||
if err != nil {
|
||||
w.WriteHeader(http.StatusInternalServerError)
|
||||
w.Write([]byte(err.Error()))
|
||||
return
|
||||
}
|
||||
|
||||
w.Header().Set("Content-Type", "text/plain; charset=utf-8")
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write(d)
|
||||
}
|
||||
|
||||
func (s *Server) backend(w http.ResponseWriter, r *http.Request) {
|
||||
switch r.Method {
|
||||
case "POST":
|
||||
|
||||
@@ -36,6 +36,7 @@ func NewServer(options ...func(*Server)) *Server {
|
||||
s.mux.HandleFunc("/readyz/enable", s.enable)
|
||||
s.mux.HandleFunc("/readyz/disable", s.disable)
|
||||
s.mux.HandleFunc("/echo", s.echo)
|
||||
s.mux.HandleFunc("/echoheaders", s.echoHeaders)
|
||||
s.mux.HandleFunc("/backend", s.backend)
|
||||
s.mux.HandleFunc("/job", s.job)
|
||||
s.mux.HandleFunc("/read", s.read)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package version
|
||||
|
||||
var VERSION = "0.0.8"
|
||||
var VERSION = "0.0.9"
|
||||
var GITCOMMIT = "unknown"
|
||||
|
||||
Reference in New Issue
Block a user