44 lines
842 B
Go
44 lines
842 B
Go
package http
|
|
|
|
import (
|
|
"io"
|
|
"net/http"
|
|
|
|
"git.loafle.net/commons_go/rpc/server"
|
|
)
|
|
|
|
type ServerHandlers struct {
|
|
server.ServerHandlers
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPreRead(r io.Reader) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPostRead(r io.Reader) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPreWriteResult(w io.Writer, result interface{}) {
|
|
writer := w.(http.ResponseWriter)
|
|
writer.Header().Set("x-content-type-options", "nosniff")
|
|
writer.Header().Set("Content-Type", "application/json; charset=utf-8")
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPostWriteResult(w io.Writer, result interface{}) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPreWriteError(w io.Writer, err error) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) OnPostWriteError(w io.Writer, err error) {
|
|
// no op
|
|
}
|
|
|
|
func (sh *ServerHandlers) Validate() {
|
|
sh.ServerHandlers.Validate()
|
|
|
|
}
|