Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #238

Merged
merged 1 commit into from Feb 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
bug fixes
  • Loading branch information
honoki committed Feb 27, 2019
commit 5267b455caeb2e055cccf0d2b6a22727c111f5c3
4 changes: 2 additions & 2 deletions lib/slanger/api/request_validation.rb
Expand Up @@ -12,7 +12,7 @@ def initialize(*args)
end

def data
@data ||= Oj.load(body["data"] || params["data"])
@data ||= Oj.strict_load(body["data"] || params["data"])
end

def body
Expand Down Expand Up @@ -87,7 +87,7 @@ def parse_body!
end

def assert_valid_json!(string)
Oj.load(string)
Oj.strict_load(string)
rescue Oj::ParserError
raise Slanger::InvalidRequest.new("Invalid request body: #{raw_body}")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/slanger/connection.rb
Expand Up @@ -9,7 +9,7 @@ def initialize socket, socket_id=nil
end

def send_message m
msg = Oj.load m
msg = Oj.strict_load m
s = msg.delete 'socket_id'
socket.send Oj.dump(msg, mode: :compat) unless s == socket_id
end
Expand Down
4 changes: 2 additions & 2 deletions lib/slanger/handler.rb
Expand Up @@ -25,9 +25,9 @@ def initialize(socket, handshake)
# Dispatches message handling to method with same name as
# the event name
def onmessage(msg)
msg = Oj.load(msg)
msg = Oj.strict_load(msg)

msg['data'] = Oj.load(msg['data']) if msg['data'].is_a? String
msg['data'] = Oj.strict_load(msg['data']) if msg['data'].is_a? String

event = msg['event'].gsub(/\Apusher:/, 'pusher_')

Expand Down
2 changes: 1 addition & 1 deletion lib/slanger/presence_channel.rb
Expand Up @@ -32,7 +32,7 @@ def initialize(attrs)
end

def subscribe(msg, callback, &blk)
channel_data = Oj.load msg['data']['channel_data']
channel_data = Oj.strict_load msg['data']['channel_data']
public_subscription_id = SecureRandom.uuid

# Send event about the new subscription to the Redis slanger:connection_notification Channel.
Expand Down
2 changes: 1 addition & 1 deletion lib/slanger/redis.rb
Expand Up @@ -25,7 +25,7 @@ def publisher
def subscriber
@subscriber ||= new_connection.pubsub.tap do |c|
c.on(:message) do |channel, message|
message = Oj.load(message)
message = Oj.strict_load(message)
c = Channel.from message['channel']
c.dispatch message, channel
end
Expand Down