class Amber::Schema::ResponseFormatters::JSONResponse

Defined in:

amber/schema/response/json_response.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(structure : Structure = Structure::Envelope, pretty : Bool = false, include_metadata : Bool = true) #

[View source]

Instance Method Detail

def bad_request(message : String = "Bad Request") : String #

Standard HTTP error responses


[View source]
def error_response(status : Int32, message : String, code : String | Nil = nil) : String #

Helper to create standard error responses


[View source]
def forbidden(message : String = "Forbidden") : String #

[View source]
def format(builder : ResponseBuilder) : String #

Format a response builder into JSON


[View source]
def format_result(result : Result) : String #

Format validation result into JSON


[View source]
def include_metadata : Bool #

[View source]
def internal_server_error(message : String = "Internal Server Error") : String #

[View source]
def not_found(message : String = "Not Found") : String #

[View source]
def pretty : Bool #

[View source]
def structure : Structure #

[View source]
def unauthorized(message : String = "Unauthorized") : String #

[View source]
def unprocessable_entity(errors : Array(Error)) : String #

[View source]