From: Jean Privat Date: Fri, 5 May 2017 19:23:28 +0000 (-0400) Subject: popcorn/pop_handlers: HttpResponse::json_* accepts any Serializable X-Git-Url: http://nitlanguage.org popcorn/pop_handlers: HttpResponse::json_* accepts any Serializable Signed-off-by: Jean Privat --- diff --git a/lib/popcorn/pop_handlers.nit b/lib/popcorn/pop_handlers.nit index f55126f..8824db0 100644 --- a/lib/popcorn/pop_handlers.nit +++ b/lib/popcorn/pop_handlers.nit @@ -451,7 +451,7 @@ redef class HttpResponse end # Write data as JSON and set the right content type header. - fun json(json: nullable Jsonable, status: nullable Int) do + fun json(json: nullable Serializable, status: nullable Int) do header["Content-Type"] = media_types["json"].as(not null) if json == null then send(null, status) @@ -471,7 +471,7 @@ redef class HttpResponse end # Write error as JSON and set the right content type header. - fun json_error(error: nullable Jsonable, status: nullable Int) do + fun json_error(error: nullable Serializable, status: nullable Int) do json(error, status) end