-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade client_golang to get POST support
In addition this changes the access logging to always print the first 256 bytes of form data (query params or post form), this way POST query or query_range have some information in the logs Fixes #48
- Loading branch information
Showing
16 changed files
with
706 additions
and
483 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package logging | ||
|
||
import ( | ||
"net/url" | ||
"strconv" | ||
"testing" | ||
) | ||
|
||
func TestFormPrefix(t *testing.T) { | ||
tooManyValues := make(url.Values) | ||
|
||
for i := 0; i < MaxFormPrefix; i++ { | ||
k := strconv.Itoa(i) | ||
tooManyValues[k] = []string{k} | ||
} | ||
|
||
tests := []struct { | ||
f url.Values | ||
v string | ||
}{ | ||
// Basic one | ||
{ | ||
f: url.Values(map[string][]string{ | ||
"a": {"a"}, | ||
}), | ||
v: `a=a`, | ||
}, | ||
// where a single value is too long | ||
{ | ||
f: url.Values(map[string][]string{ | ||
"a": {"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, | ||
}), | ||
v: `a=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa`, | ||
}, | ||
// Where there are too many values | ||
{ | ||
f: tooManyValues, | ||
}, | ||
} | ||
|
||
for i, test := range tests { | ||
t.Run(strconv.Itoa(i), func(t *testing.T) { | ||
v := FormPrefix(test.f) | ||
if len(v) > MaxFormPrefix { | ||
t.Fatalf("Value over MaxFormPrefix: expected=%d actual=%d", MaxFormPrefix, len(v)) | ||
} | ||
if test.v != "" { | ||
if v != test.v { | ||
t.Fatalf("Mismatch in values expected=%s actual=%s", test.v, v) | ||
} | ||
} | ||
}) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.