Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b1df5bf

Browse filesBrowse 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
Copy full SHA for b1df5bf

File tree

3 files changed

+5
-3
lines changed
Filter options

3 files changed

+5
-3
lines changed

‎binder.go

Copy file name to clipboardExpand all lines: binder.go
+1-1Lines 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

Copy file name to clipboardExpand all lines: module.go
+3-1Lines 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

Copy file name to clipboardExpand all lines: router.go
+1-1Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.