코드 정리 및 websocket도 http와 비슷하게 api handler로 통일
This commit is contained in:
@ -618,11 +618,11 @@ func MakeHttpRequestForLogging(r *http.Request) *http.Request {
|
||||
}
|
||||
|
||||
type apiFuncType func(http.ResponseWriter, *http.Request)
|
||||
type HttpApiReceiver struct {
|
||||
type HttpApiHandler struct {
|
||||
methods map[string]apiFuncType
|
||||
}
|
||||
|
||||
func MakeHttpApiReceiver[T any](receiver *T, receiverName string) HttpApiReceiver {
|
||||
func MakeHttpApiHandler[T any](receiver *T, receiverName string) HttpApiHandler {
|
||||
methods := make(map[string]apiFuncType)
|
||||
|
||||
tp := reflect.TypeOf(receiver)
|
||||
@ -662,7 +662,7 @@ func MakeHttpApiReceiver[T any](receiver *T, receiverName string) HttpApiReceive
|
||||
}
|
||||
}
|
||||
|
||||
return HttpApiReceiver{
|
||||
return HttpApiHandler{
|
||||
methods: methods,
|
||||
}
|
||||
}
|
||||
@ -671,7 +671,7 @@ type HttpApiHandlerContainer struct {
|
||||
methods map[string]apiFuncType
|
||||
}
|
||||
|
||||
func (hc *HttpApiHandlerContainer) RegistReceiver(receiver HttpApiReceiver) {
|
||||
func (hc *HttpApiHandlerContainer) RegisterApiHandler(receiver HttpApiHandler) {
|
||||
if hc.methods == nil {
|
||||
hc.methods = make(map[string]apiFuncType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user