summaryrefslogtreecommitdiff
path: root/service/http/parse.go
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-12 18:34:30 +0300
committerWolfy-J <[email protected]>2018-06-12 18:34:30 +0300
commit18b2cb4a9b1a8a22ab260d2a0a611765f8e113a3 (patch)
tree5ce4c4490c0920a8ee392bce450dc7f1183a691c /service/http/parse.go
parent9980f8a1a4f8c2aebd8e40a8e892bda4bf734eb0 (diff)
tests!
Diffstat (limited to 'service/http/parse.go')
-rw-r--r--service/http/parse.go30
1 files changed, 6 insertions, 24 deletions
diff --git a/service/http/parse.go b/service/http/parse.go
index 96ffcdcc..0224af41 100644
--- a/service/http/parse.go
+++ b/service/http/parse.go
@@ -31,23 +31,14 @@ func parseData(r *http.Request) (dataTree, error) {
// pushes value into data tree.
func (d dataTree) push(k string, v []string) {
- if len(v) == 0 {
- // skip empty values
- return
- }
-
- indexes := fetchIndexes(k)
- if len(indexes) <= MaxLevel {
- d.mount(indexes, v)
+ keys := fetchIndexes(k)
+ if len(keys) <= MaxLevel {
+ d.mount(keys, v)
}
}
// mount mounts data tree recursively.
func (d dataTree) mount(i []string, v []string) {
- if len(v) == 0 {
- return
- }
-
if len(i) == 1 {
// single value context
d[i[0]] = v[0]
@@ -106,23 +97,14 @@ func exists(path string) bool {
// pushes new file upload into it's proper place.
func (d fileTree) push(k string, v []*FileUpload) {
- if len(v) == 0 {
- // skip empty values
- return
- }
-
- indexes := fetchIndexes(k)
- if len(indexes) <= MaxLevel {
- d.mount(indexes, v)
+ keys := fetchIndexes(k)
+ if len(keys) <= MaxLevel {
+ d.mount(keys, v)
}
}
// mount mounts data tree recursively.
func (d fileTree) mount(i []string, v []*FileUpload) {
- if len(v) == 0 {
- return
- }
-
if len(i) == 1 {
// single value context
d[i[0]] = v[0]