Initial euclide.org release
This commit is contained in:
22
vendor/github.com/jarcoal/httpmock/internal/submatches.go
generated
vendored
Normal file
22
vendor/github.com/jarcoal/httpmock/internal/submatches.go
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type submatchesKeyType struct{}
|
||||
|
||||
var submatchesKey submatchesKeyType
|
||||
|
||||
func SetSubmatches(req *http.Request, submatches []string) *http.Request {
|
||||
if len(submatches) > 0 {
|
||||
return req.WithContext(context.WithValue(req.Context(), submatchesKey, submatches))
|
||||
}
|
||||
return req
|
||||
}
|
||||
|
||||
func GetSubmatches(req *http.Request) []string {
|
||||
sm, _ := req.Context().Value(submatchesKey).([]string)
|
||||
return sm
|
||||
}
|
||||
Reference in New Issue
Block a user