提交 a65c99e7 作者: Matt Bell 提交者: Juan Batiz-Benet

commands: Added Request#Options so consumers can iterate through provided options

上级 e8b37acd
......@@ -13,6 +13,7 @@ type optMap map[string]interface{}
type Request interface {
Path() []string
Option(name string) (interface{}, bool)
Options() map[string]interface{}
SetOption(name string, val interface{})
Arguments() []string
Stream() io.Reader
......@@ -39,6 +40,15 @@ func (r *request) Option(name string) (interface{}, bool) {
return val, err
}
// Options returns a copy of the option map
func (r *request) Options() map[string]interface{} {
output := make(optMap)
for k, v := range r.options {
output[k] = v
}
return output
}
// SetOption sets the value of the option for given name.
func (r *request) SetOption(name string, val interface{}) {
r.options[name] = val
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论