mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 17:28:53 +02:00
refactor: replace custom helper with stdlib strings.*
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"strings"
|
||||
|
||||
nettypes "github.com/yusing/godoxy/internal/net/types"
|
||||
strutils "github.com/yusing/goutils/strings"
|
||||
)
|
||||
|
||||
type (
|
||||
@@ -54,7 +53,7 @@ func (method HTTPMethod) Fulfill(req *http.Request, res *http.Response) bool {
|
||||
|
||||
// Parse implements strutils.Parser.
|
||||
func (k *HTTPHeader) Parse(v string) error {
|
||||
split := strutils.SplitRune(v, '=')
|
||||
split := strings.Split(v, "=")
|
||||
switch len(split) {
|
||||
case 1:
|
||||
split = append(split, "")
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
strutils "github.com/yusing/goutils/strings"
|
||||
)
|
||||
@@ -32,7 +33,7 @@ var defaultChunkSize = 32 * kilobyte
|
||||
//
|
||||
// Parse implements strutils.Parser.
|
||||
func (r *Retention) Parse(v string) (err error) {
|
||||
split := strutils.SplitSpace(v)
|
||||
split := strings.Fields(v)
|
||||
if len(split) != 2 {
|
||||
return fmt.Errorf("%w: %s", ErrInvalidSyntax, v)
|
||||
}
|
||||
|
||||
@@ -4,9 +4,9 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
strutils "github.com/yusing/goutils/strings"
|
||||
)
|
||||
|
||||
type StatusCodeRange struct {
|
||||
@@ -22,7 +22,7 @@ func (r *StatusCodeRange) Includes(code int) bool {
|
||||
|
||||
// Parse implements strutils.Parser.
|
||||
func (r *StatusCodeRange) Parse(v string) error {
|
||||
split := strutils.SplitRune(v, '-')
|
||||
split := strings.Split(v, "-")
|
||||
switch len(split) {
|
||||
case 1:
|
||||
start, err := strconv.Atoi(split[0])
|
||||
|
||||
Reference in New Issue
Block a user