Skip to content

Commit f2ffa73

Browse files
authored
Support go 1.19+ (#4)
1 parent bc510dc commit f2ffa73

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
build:
1515
strategy:
1616
matrix:
17-
go: [ '1.22' ]
17+
go: [ '1.19', '1.20', '1.21', '1.22' ]
1818
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
1919
runs-on: ${{ matrix.os }}
2020
steps:

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/no-src/rest-client
22

3-
go 1.22.2
3+
go 1.19
44

55
require (
66
github.com/no-src/log v0.3.2

internal/http.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"io"
77
"net/http"
88
"net/url"
9-
"slices"
109
"strings"
1110
)
1211

@@ -51,7 +50,12 @@ func isLegalHTTPMethod(method string) bool {
5150
http.MethodGet, http.MethodHead, http.MethodPost, http.MethodPut, http.MethodPatch,
5251
http.MethodDelete, http.MethodConnect, http.MethodOptions, http.MethodTrace,
5352
}
54-
return slices.Contains(allows, method)
53+
for _, m := range allows {
54+
if m == method {
55+
return true
56+
}
57+
}
58+
return false
5559
}
5660

5761
func isLegalURL(u string) bool {

0 commit comments

Comments
 (0)