Open trapped opened 8 years ago
Here the status code is allowed to be nil, causing the compiler to complain:
nil
in ./libs/amethyst/amethyst/base/handler.cr:12: instantiating 'Amethyst::Http::Response#build()' response.build ^~~~~ in ./libs/amethyst/amethyst/http/response.cr:23: instantiating 'HTTP::Response:Class#new((Nil | Int32), String, HTTP::Headers)' return HTTP::Response.new(@status, @body, headers = @headers) ^~~ instantiating 'HTTP::Response#initialize((Nil | Int32), String, HTTP::Headers, Nil, String, Nil)' in /Users/giorgio/Documents/crystal/src/http/response.cr:14: instantiating 'HTTP::Response:Class#mandatory_body?((Nil | Int32))' if Response.mandatory_body?(@status_code) ^~~~~~~~~~~~~~~ in /Users/giorgio/Documents/crystal/src/http/response.cr:77: undefined method '/' for Nil (compile-time type is (Nil | Int32)) !(status_code / 100 == 1 || status_code == 204 || status_code == 304)
Either Http::Response.new should not allow a nil status code, or Http::Response.build should check for that and use a "default" one.
Http::Response.new
Http::Response.build
Here the status code is allowed to be
nil
, causing the compiler to complain:Either
Http::Response.new
should not allow a nil status code, orHttp::Response.build
should check for that and use a "default" one.