1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-12-24 10:07:04 +02:00
go-micro/client/mock/context.go
2016-04-06 18:33:57 +01:00

17 lines
370 B
Go

package mock
import (
"golang.org/x/net/context"
)
type responseKey struct{}
func fromContext(ctx context.Context) (map[string][]MockResponse, bool) {
r, ok := ctx.Value(responseKey{}).(map[string][]MockResponse)
return r, ok
}
func newContext(ctx context.Context, r map[string][]MockResponse) context.Context {
return context.WithValue(ctx, responseKey{}, r)
}