mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-14 17:44:42 +00:00
Use strings.ToLower on source name parameters
This commit is contained in:
parent
346c761ef6
commit
6f5962f8f2
2 changed files with 2 additions and 2 deletions
|
@ -454,7 +454,7 @@ func (ha *Argument) Get(r *Request) (string, error) {
|
||||||
return "", errors.New("request is nil")
|
return "", errors.New("request is nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ha.Name {
|
switch strings.ToLower(ha.Name) {
|
||||||
case "remote-addr":
|
case "remote-addr":
|
||||||
return r.RawRequest.RemoteAddr, nil
|
return r.RawRequest.RemoteAddr, nil
|
||||||
case "method":
|
case "method":
|
||||||
|
|
|
@ -262,7 +262,7 @@ var argumentGetTests = []struct {
|
||||||
{"header", "a", map[string]interface{}{"A": "z"}, nil, nil, nil, "z", true},
|
{"header", "a", map[string]interface{}{"A": "z"}, nil, nil, nil, "z", true},
|
||||||
{"url", "a", nil, map[string]interface{}{"a": "z"}, nil, nil, "z", true},
|
{"url", "a", nil, map[string]interface{}{"a": "z"}, nil, nil, "z", true},
|
||||||
{"payload", "a", nil, nil, map[string]interface{}{"a": "z"}, nil, "z", true},
|
{"payload", "a", nil, nil, map[string]interface{}{"a": "z"}, nil, "z", true},
|
||||||
{"request", "method", nil, nil, map[string]interface{}{"a": "z"}, &http.Request{Method: "POST", RemoteAddr: "127.0.0.1:1234"}, "POST", true},
|
{"request", "METHOD", nil, nil, map[string]interface{}{"a": "z"}, &http.Request{Method: "POST", RemoteAddr: "127.0.0.1:1234"}, "POST", true},
|
||||||
{"request", "remote-addr", nil, nil, map[string]interface{}{"a": "z"}, &http.Request{Method: "POST", RemoteAddr: "127.0.0.1:1234"}, "127.0.0.1:1234", true},
|
{"request", "remote-addr", nil, nil, map[string]interface{}{"a": "z"}, &http.Request{Method: "POST", RemoteAddr: "127.0.0.1:1234"}, "127.0.0.1:1234", true},
|
||||||
{"string", "a", nil, nil, map[string]interface{}{"a": "z"}, nil, "a", true},
|
{"string", "a", nil, nil, map[string]interface{}{"a": "z"}, nil, "a", true},
|
||||||
// failures
|
// failures
|
||||||
|
|
Loading…
Add table
Reference in a new issue