There are cases where a handler that returns a json element needs to
return a successfull empty response. This is common in async operation.
Though it is legit to return an empty string in this situation, it is
cleaner to return an empty response.
This adds a json_void class, that a method that needs to return a value
(i.e. the json_function) can return and the formatter will set the
response to empty.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This patch adds a general assignment operator to the json_list object.
It can accept any data structure that support const range iteration and
that its contained object can be assigned to the json_list object.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
This is a migration of the basic json support taken from the
osv/httpserver.
The routes uses the json object to return errors in a json format.
This also adds json_exception which has a constructor from an exception.
Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>