rpc/adapter/http/server_handlers.go
crusader b284554280 ing
2017-11-08 15:35:27 +09:00

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()
}