Showing 2 of 6 files from the diff.

@@ -29,6 +29,21 @@
Loading
29 29
var emptyField = reflect.StructField{}
30 30
31 31
func mapFormByTag(ptr interface{}, form map[string][]string, tag string) error {
32 +
	// Check if ptr is a map
33 +
	ptrVal := reflect.ValueOf(ptr)
34 +
	var pointed interface{}
35 +
	if ptrVal.Kind() == reflect.Ptr {
36 +
		ptrVal = ptrVal.Elem()
37 +
		pointed = ptrVal.Interface()
38 +
	}
39 +
	if ptrVal.Kind() == reflect.Map &&
40 +
		ptrVal.Type().Key().Kind() == reflect.String {
41 +
		if pointed != nil {
42 +
			ptr = pointed
43 +
		}
44 +
		return setFormMap(ptr, form)
45 +
	}
46 +
32 47
	return mappingByPtr(ptr, formSource(form), tag)
33 48
}
34 49
@@ -349,3 +364,29 @@
Loading
349 364
	}
350 365
	return str[:idx], str[idx+len(sep):]
351 366
}
367 +
368 +
func setFormMap(ptr interface{}, form map[string][]string) error {
369 +
	el := reflect.TypeOf(ptr).Elem()
370 +
371 +
	if el.Kind() == reflect.Slice {
372 +
		ptrMap, ok := ptr.(map[string][]string)
373 +
		if !ok {
374 +
			return errors.New("cannot convert to map slices of strings")
375 +
		}
376 +
		for k, v := range form {
377 +
			ptrMap[k] = v
378 +
		}
379 +
380 +
		return nil
381 +
	}
382 +
383 +
	ptrMap, ok := ptr.(map[string]string)
384 +
	if !ok {
385 +
		return errors.New("cannot convert to map of strings")
386 +
	}
387 +
	for k, v := range form {
388 +
		ptrMap[k] = v[len(v)-1] // pick last
389 +
	}
390 +
391 +
	return nil
392 +
}

@@ -891,7 +891,7 @@
Loading
891 891
}
892 892
893 893
// JSONP serializes the given struct as JSON into the response body.
894 -
// It add padding to response body to request data from a server residing in a different domain than the client.
894 +
// It adds padding to response body to request data from a server residing in a different domain than the client.
895 895
// It also sets the Content-Type as "application/javascript".
896 896
func (c *Context) JSONP(code int, obj interface{}) {
897 897
	callback := c.DefaultQuery("callback", "")
@@ -968,7 +968,7 @@
Loading
968 968
	})
969 969
}
970 970
971 -
// File writes the specified file into the body stream in a efficient way.
971 +
// File writes the specified file into the body stream in an efficient way.
972 972
func (c *Context) File(filepath string) {
973 973
	http.ServeFile(c.Writer, c.Request, filepath)
974 974
}
Files Coverage
binding 100.00%
render 92.96%
auth.go 100.00%
context.go 97.51%
debug.go 92.50%
deprecated.go 100.00%
errors.go 100.00%
fs.go 100.00%
gin.go 99.01%
logger.go 100.00%
mode.go 100.00%
path.go 100.00%
recovery.go 97.18%
response_writer.go 93.33%
routergroup.go 100.00%
test_helpers.go 100.00%
tree.go 100.00%
utils.go 96.83%
Project Totals (41 files) 98.48%
4754.14
1.14.x=.14.x
TRAVIS_OS_NAME=linux
4754.12
1.13.x=.13.x
TRAVIS_OS_NAME=linux
4754.16
TRAVIS_OS_NAME=linux
1.15.x=.15.x
4754.15
TRAVIS_OS_NAME=linux
1.15.x=.15.x
4754.13
1.14.x=.14.x
TRAVIS_OS_NAME=linux
4754.4
1.14.x=.14.x
TRAVIS_OS_NAME=linux
4754.3
1.13.x=.13.x
TRAVIS_OS_NAME=linux
4754.1
TRAVIS_OS_NAME=linux
1.12.x=.12.x
4754.2
1.13.x=.13.x
TRAVIS_OS_NAME=linux
4754.5
1.14.x=.14.x
TRAVIS_OS_NAME=linux
4754.6
TRAVIS_OS_NAME=linux
1.15.x=.15.x
4754.11
1.13.x=.13.x
TRAVIS_OS_NAME=linux
4754.7
TRAVIS_OS_NAME=linux
1.15.x=.15.x
4754.10
TRAVIS_OS_NAME=linux
1.12.x=.12.x
4754.9
1.11.x=.11.x
TRAVIS_OS_NAME=linux
1
coverage:
2
  notify:
3
    gitter:
4
      default:
5
        url: https://webhooks.gitter.im/e/d90dcdeeab2f1e357165
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading