mirror of
https://github.com/buger/goreplay.git
synced 2024-04-21 12:32:02 +00:00
28 lines
411 B
Go
28 lines
411 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
"bytes"
|
|
)
|
|
|
|
type HTTPMethods [][]byte
|
|
|
|
func (h *HTTPMethods) String() string {
|
|
return fmt.Sprint(*h)
|
|
}
|
|
|
|
func (h *HTTPMethods) Set(value string) error {
|
|
*h = append(*h, []byte(strings.ToUpper(value)))
|
|
return nil
|
|
}
|
|
|
|
func (h *HTTPMethods) Contains(value []byte) bool {
|
|
for _, method := range *h {
|
|
if bytes.Equal(value, method) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|