Skip to content

Commit b1df5bf

Browse files
committed
Logged as error for json unmarshal error
Changed module filepath match to use filepath library Assigned typeOfController when controller match requested
1 parent c370e23 commit b1df5bf

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

binder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ func bindStruct(params *Params, name string, typ reflect.Type) reflect.Value {
298298
if params.JSON != nil {
299299
// Try to inject the response as a json into the created result
300300
if err := json.Unmarshal(params.JSON, resultPointer.Interface()); err != nil {
301-
binderLog.Warn("bindStruct Unable to unmarshal request", "name", name, "error", err)
301+
binderLog.Error("bindStruct Unable to unmarshal request", "name", name, "error", err,"data", string(params.JSON))
302302
}
303303
return result
304304
}

module.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func ModuleFromPath(path string, addGopathToPath bool) (module *Module) {
8888
for i := range Modules {
8989
if addGopathToPath {
9090
for _, gopath := range gopathList {
91-
if strings.HasPrefix(gopath+"/src/"+path, Modules[i].Path) {
91+
if strings.HasPrefix(filepath.ToSlash(filepath.Clean(filepath.Join(gopath,"src",path))), Modules[i].Path) {
9292
module = Modules[i]
9393
break
9494
}
@@ -164,6 +164,8 @@ func loadModules() {
164164
if strings.HasPrefix(key, m.ImportPath) {
165165
moduleLog.Debug("Module called callback", "moduleKey", m.ImportPath, "callbackKey", key)
166166
callback(m)
167+
found = true
168+
break
167169
}
168170
}
169171
if !found {

router.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func (router *Router) Route(req *Request) (routeMatch *RouteMatch) {
211211
controllerName = route.ControllerName
212212
if controllerName[0] == ':' {
213213
controllerName = strings.ToLower(params[controllerName[1:]][0])
214-
if route.ModuleSource.ControllerByName(controllerName, methodName) != nil {
214+
if typeOfController = route.ModuleSource.ControllerByName(controllerName, methodName); typeOfController != nil {
215215
break
216216
}
217217
} else {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy