MCPcopy Create free account
hub / github.com/gavv/httpexpect / Decode

Method Decode

object.go:107–117  ·  view source on GitHub ↗

Decode unmarshals the underlying value attached to the Object to a target variable target should be one of this: - pointer to an empty interface - pointer to a map - pointer to a struct Example: type S struct{ Foo int `json:"foo"` Bar []interface{} `json:"bar"`

(target interface{})

Source from the content-addressed store, hash-verified

105// map[string]interface{}{"a": "b"}, struct{ A int }{123},
106// }, target)
107func (o *Object) Decode(target interface{}) *Object {
108 opChain := o.chain.enter("Decode()")
109 defer opChain.leave()
110
111 if opChain.failed() {
112 return o
113 }
114
115 canonDecode(opChain, o.value, target)
116 return o
117}
118
119// Alias is similar to Value.Alias.
120func (o *Object) Alias(name string) *Object {

Callers 1

TestObject_DecodeFunction · 0.95

Calls 4

canonDecodeFunction · 0.85
enterMethod · 0.80
leaveMethod · 0.80
failedMethod · 0.80

Tested by 1

TestObject_DecodeFunction · 0.76