This commit is contained in:
Pavel Ponomarev 2017-05-23 22:29:49 +00:00 committed by GitHub
commit a1bede8fc0
2 changed files with 4 additions and 1 deletions

View File

@ -25,7 +25,7 @@ const (
)
var userAgentPattern = regexp.MustCompile(
`^(?:curl|Wget|fetch\slibfetch|ddclient|Go-http-client|HTTPie)\/.*|Go\s1\.1\spackage\shttp$`,
`^(?:curl|Wget|fetch\slibfetch|ddclient|Go-http-client|HTTPie|[pP]ython-\w+)\/.*|Go\s1\.1\spackage\shttp$`,
)
type API struct {

View File

@ -156,6 +156,9 @@ func TestCLIMatcher(t *testing.T) {
{"Go-http-client/1.1", true},
{"Go-http-client/2.0", true},
{"ddclient/3.8.3", true},
{"Python-urllib/2.7", true},
{"python-urllib/3.5", true},
{"python-requests/2.11", true},
{browserUserAgent, false},
}
for _, tt := range tests {