class
Amber::Schema::ResponseFormatters::JSONResponse
- Amber::Schema::ResponseFormatters::JSONResponse
- Reference
- Object
Defined in:
amber/schema/response/json_response.crConstructors
Instance Method Summary
-
#bad_request(message : String = "Bad Request") : String
Standard HTTP error responses
-
#error_response(status : Int32, message : String, code : String | Nil = nil) : String
Helper to create standard error responses
- #forbidden(message : String = "Forbidden") : String
-
#format(builder : ResponseBuilder) : String
Format a response builder into JSON
-
#format_result(result : Result) : String
Format validation result into JSON
- #include_metadata : Bool
- #internal_server_error(message : String = "Internal Server Error") : String
- #not_found(message : String = "Not Found") : String
- #pretty : Bool
- #structure : Structure
- #unauthorized(message : String = "Unauthorized") : String
- #unprocessable_entity(errors : Array(Error)) : String
Constructor Detail
def self.new(structure : Structure = Structure::Envelope, pretty : Bool = false, include_metadata : Bool = true)
#
Instance Method Detail
Standard HTTP error responses
Helper to create standard error responses