MCPcopy
hub / github.com/livebud/bud / Unmarshal

Function Unmarshal

framework/controller/controllerrt/request/unmarshal.go:14–24  ·  view source on GitHub ↗

Unmarshal the request data into v

(r *http.Request, v interface{})

Source from the content-addressed store, hash-verified

12
13// Unmarshal the request data into v
14func Unmarshal(r *http.Request, v interface{}) error {
15 err := unmarshalBody(r, v)
16 if err != nil {
17 return err
18 }
19 err = unmarshalURL(r.URL, v)
20 if err != nil {
21 return err
22 }
23 return nil
24}
25
26func unmarshalBody(r *http.Request, v interface{}) error {
27 contentType := r.Header.Get("Content-Type")

Callers 15

TestJSONEmptyFunction · 0.85
TestFormEmptyFunction · 0.85
TestStringJSONEmptiesFunction · 0.85
TestStringFormEmptiesFunction · 0.85
TestStringJSONEmptyQueryFunction · 0.85
TestStringFormEmptyQueryFunction · 0.85
TestStringJSONQueryFunction · 0.85
TestStringFormQueryFunction · 0.85
TestNumberJSONEmptiesFunction · 0.85
TestNumberFormEmptiesFunction · 0.85

Calls 2

unmarshalBodyFunction · 0.85
unmarshalURLFunction · 0.85

Tested by 15

TestJSONEmptyFunction · 0.68
TestFormEmptyFunction · 0.68
TestStringJSONEmptiesFunction · 0.68
TestStringFormEmptiesFunction · 0.68
TestStringJSONEmptyQueryFunction · 0.68
TestStringFormEmptyQueryFunction · 0.68
TestStringJSONQueryFunction · 0.68
TestStringFormQueryFunction · 0.68
TestNumberJSONEmptiesFunction · 0.68
TestNumberFormEmptiesFunction · 0.68