popcorn/pop_handlers: HttpResponse::json_* accepts any Serializable
authorJean Privat <jean@pryen.org>
Fri, 5 May 2017 19:23:28 +0000 (15:23 -0400)
committerJean Privat <jean@pryen.org>
Tue, 9 May 2017 18:29:14 +0000 (14:29 -0400)
Signed-off-by: Jean Privat <jean@pryen.org>

lib/popcorn/pop_handlers.nit

index f55126f..8824db0 100644 (file)
@@ -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