Using https://requestb.in , I see that the webcam is sending the + json header data correctly. But when I send a json request to my server, I get a json error message.
My controller (cannot receive body data):
class ReceiverController < ApplicationController skip_before_filter :verify_authenticity_token def handle_post puts request.headers['Content-Type'] puts "request:" puts JSON.parse(request.raw_post) puts "request2:" puts JSON.parse(request.body.read) end end
Error output:
application/json; charset=utf-8 request: JSON::ParserError (A JSON text must at least contain two octets!): app/controllers/receiver_controller.rb:69:in `handle_post' request2: Completed 500 Internal Server Error in 7ms (ActiveRecord: 0.0ms)
routes.rb
post "/receive" => 'receiver#handle_post'
ruby ruby-on-rails webhooks
Taylor
source share