1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-03-17 20:28:06 +02:00

18 lines
365 B
Go
Raw Normal View History

2020-12-26 15:32:45 +00:00
package mock
import (
2021-10-12 12:55:53 +01:00
"go-micro.dev/v4/client"
2020-12-26 15:32:45 +00:00
)
// Response sets the response methods for a service
func Response(service string, response []MockResponse) client.Option {
return func(o *client.Options) {
r, ok := fromContext(o.Context)
if !ok {
r = make(map[string][]MockResponse)
}
r[service] = response
o.Context = newContext(o.Context, r)
}
}