mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-12 08:23:58 +02:00
18 lines
365 B
Go
18 lines
365 B
Go
package mock
|
|
|
|
import (
|
|
"go-micro.dev/v4/client"
|
|
)
|
|
|
|
// 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)
|
|
}
|
|
}
|