Give ban causes, limit kinds, alert events, actions and dispositions named types (closes #428)
check / check (push) Failing after 5m25s
check / check (push) Failing after 5m25s
Each fixed set of string constants becomes a named string type in the package that owns it, and the fields and parameters that carry it use the type: bans.Cause, ratelimit.LimitKind, alerts.Event, alerts.DestinationName, rules.Action, requestlog.Action, requestlog.Offence, requestlog.WAFLineKind and waf.Disposition. Every value keeps its string, so the logs, state files, alerts and metrics do not change. The switches exhaustive now checks list their missing cases. Model: opus-5-5
This commit is contained in:
1 parent
40386dce6e
commit
d0264ff6a7
41 files changed
+358
-248
No files matched your search
@@ -504,7 +504,9 @@ type sender struct {
|
||||
}
|
||||
|
||||
// get sends a GET request for / from the client at from.
|
||||
func (s *sender) get(from string, status int, action string) logLine {
|
||||
func (s *sender) get(
|
||||
from string, status int, action requestlog.Action,
|
||||
) logLine {
|
||||
s.t.Helper()
|
||||
|
||||
return s.request(from, "/", status, action)
|
||||
@@ -517,7 +519,7 @@ func (s *sender) get(from string, status int, action string) logLine {
|
||||
func (s *sender) request(
|
||||
from, path string,
|
||||
status int,
|
||||
action string,
|
||||
action requestlog.Action,
|
||||
) logLine {
|
||||
s.t.Helper()
|
||||
|
||||
@@ -527,7 +529,7 @@ func (s *sender) request(
|
||||
// requestWithHeader is request with header, such as "Authorization:
|
||||
// Bearer x", added to the request unless it is "".
|
||||
func (s *sender) requestWithHeader(
|
||||
from, path, header string, status int, action string,
|
||||
from, path, header string, status int, action requestlog.Action,
|
||||
) logLine {
|
||||
s.t.Helper()
|
||||
|
||||
@@ -553,7 +555,9 @@ func (s *sender) requestWithHeader(
|
||||
// the Core Rule Set past any shorter wait. go test's -timeout ends a test
|
||||
// whose answer never comes.
|
||||
func (s *sender) requestWithBody(
|
||||
method, from, path, header, body string, status int, action string,
|
||||
method, from, path, header, body string,
|
||||
status int,
|
||||
action requestlog.Action,
|
||||
) (logLine, answer) {
|
||||
s.t.Helper()
|
||||
|
||||
|
||||
Reference in new issue
Block a user