Merge pull request #96 from unistack-org/codec

lazy codec init
This commit is contained in:
Василий Толстов 2022-02-01 11:22:39 +03:00 committed by GitHub
commit ffe5f1c9be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -97,11 +97,6 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.errorHandler(ctx, nil, w, r, fmt.Errorf("path must starts with /"), http.StatusBadRequest) h.errorHandler(ctx, nil, w, r, fmt.Errorf("path must starts with /"), http.StatusBadRequest)
return return
} }
cf, err := h.newCodec(ct)
if err != nil {
h.errorHandler(ctx, nil, w, r, err, http.StatusBadRequest)
return
}
matches := make(map[string]interface{}) matches := make(map[string]interface{})
@ -166,6 +161,12 @@ func (h *httpServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
} }
} }
cf, err := h.newCodec(ct)
if err != nil {
h.errorHandler(ctx, nil, w, r, err, http.StatusBadRequest)
return
}
var argv, replyv reflect.Value var argv, replyv reflect.Value
// Decode the argument value. // Decode the argument value.