3 Package httpjson creates HTTP handlers to map request
4 and response formats onto Go function signatures.
5 The request body is decoded as a JSON text
6 into an arbitrary value and the function's return value
7 is encoded as a JSON text for the response body.
8 The function's signature determines the types of the
9 input and output values.
11 For example, the handler for a function with signature
13 func(struct{ FavColor, Birthday string })
15 would read the JSON request body into a variable
16 of type struct{ FavColor, Birthday string }, then call
19 The allowed elements of a function signature are:
23 request body (optional)
26 response body (optional)
29 All elements are optional.
30 Thus, the smallest possible function signature is
34 If the function returns a non-nil error,
35 the handler will call the error function provided
37 Otherwise, the handler will write the return value
38 as JSON text to the response body.
39 If the return type is omitted, the handler will send
40 a default response value.