Outputs
- if the return value is
stringthen it will send that string as the response's body. - If it's an
intthen it will send it as a status code. - If it's an
errorthen it will set a bad request with that error as its reason. - If it's an
errorand anintthen the error code is the output integer instead of 400(bad request). - If it's a custom
structthen it sent as a JSON, when a Content-Type header is not already set. - If it's a custom
structand astringthen the second output value, string, it will be the Content-Type and so on.
| Type | Replies to |
|---|---|
| string | body |
| string, string | content-type, body |
| string, int | body, status code |
| int | status code |
| int, string | status code, body |
| error | if not nil, bad request |
| any, bool | if false then fires not found |
| <Τ> | JSON body |
| <Τ>, string | body, content-type |
| <Τ>, error | JSON body or bad request |
| <Τ>, int | JSON body, status code |
| Result | calls its Dispatch method |
| PreflightResult | calls its Preflight method |
Where
<T>means any struct value.
