1
0
mirror of https://github.com/go-micro/go-micro.git synced 2024-11-24 08:02:32 +02:00
go-micro/client/mock/context.go

17 lines
353 B
Go
Raw Normal View History

2016-04-06 19:33:57 +02:00
package mock
import (
2018-03-03 13:53:52 +02:00
"context"
2016-04-06 19:33:57 +02:00
)
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)
}