lib/faastruby/server/runner_methods.rb in faastruby-0.4.18 vs lib/faastruby/server/runner_methods.rb in faastruby-0.5.0

- old
+ new

@@ -1,7 +1,8 @@ module FaaStRuby module RunnerMethods + require 'yaml' def rendered! @rendered = true end def rendered? @rendered @@ -50,36 +51,36 @@ headers["Content-Type"] ||= "application/octet-stream" bin = binary resp_body = bin ? Base64.urlsafe_encode64(body) : body when data headers["Content-Type"] ||= "application/octet-stream" - resp_body = Base64.urlsafe_encode64(data) + resp_body = Base64.urlsafe_encode64(data, padding: false) bin = true when js headers["Content-Type"] ||= "text/javascript" resp_body = js when css headers["Content-Type"] ||= "text/css" resp_body = css when png headers["Content-Type"] ||= "image/png" - resp_body = Base64.urlsafe_encode64(png) + resp_body = Base64.urlsafe_encode64(File.binread(png), padding: false) bin = true when svg headers["Content-Type"] ||= "image/svg+xml" resp_body = svg when jpeg headers["Content-Type"] ||= "image/jpeg" - resp_body = Base64.urlsafe_encode64(jpeg) + resp_body = Base64.urlsafe_encode64(File.binread(jpeg), padding: false) bin = true when gif headers["Content-Type"] ||= "image/gif" - resp_body = Base64.urlsafe_encode64(gif) + resp_body = Base64.urlsafe_encode64(File.binread(gif), padding: false) bin = true when icon headers["Content-Type"] ||= "image/x-icon" - resp_body = Base64.urlsafe_encode64(icon) + resp_body = Base64.urlsafe_encode64(File.binread(icon), padding: false) bin = true end respond_with(resp_body, status: status, headers: headers, binary: bin) end @@ -87,20 +88,20 @@ headers = {"Location" => function || url} respond_with(nil, status: status, headers: headers, binary: false) end def puts(msg) - super "[#{@short_path}] #{msg}".green + super "[#{@path}] #{msg}".green end - def publish(channel, data: nil) - begin - encoded_data = data ? Base64.urlsafe_encode64(data, padding: false) : "" - payload = %(#{Base64.urlsafe_encode64(channel, padding: false)},#{encoded_data}) - EventHub.queue.push payload - true - rescue - false - end - end + # def publish(channel, data: nil) + # begin + # encoded_data = data ? Base64.urlsafe_encode64(data, padding: false) : "" + # payload = %(#{Base64.urlsafe_encode64(channel, padding: false)},#{encoded_data}) + # EventHub.queue.push payload + # true + # rescue + # false + # end + # end end end \ No newline at end of file