Wobserver v0.1.8 Wobserver.Web.Router.Helper View Source

Helper methods for routers.

Link to this section Summary

Functions

Sends a JSON encoded response back to the client

Link to this section Functions

Link to this function send_json_resp(data, conn) View Source
send_json_resp(data :: atom | String.t | map | list, conn :: Plug.Conn.t) :: Plug.Conn.t

Sends a JSON encoded response back to the client.

The https status will be 200 or 500 if the given data can not be JSON encoded.

The conn content type is set to application/json, only if the data could be encoded.