unprocessable_entity if query.empty? postcode = query.split("=")[1] return unprocessable_entity if postcode.to_i.zero? [200, {"content-type" => "application/json"}, [fetch(postcode)]] end def unprocessable_entity res = "invalid request".to_json [422, {"content-type" => "application/json"}, [res]] end https://github.com/y-yagi/h2o-mruby- server/blob/master/scripts/addresser.rb