Skip to content

Commit 40a2f64

Browse files
committed
Return body if any on 202
1 parent 67e968a commit 40a2f64

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/pusher/request.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def handle_response(status_code, body)
8585
when 200
8686
return symbolize_first_level(MultiJson.decode(body))
8787
when 202
88-
return true
88+
return body.empty? ? true : symbolize_first_level(MultiJson.decode(body))
8989
when 400
9090
raise Error, "Bad request: #{body}"
9191
when 401

spec/client_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,8 @@
653653
:body => MultiJson.encode({ :foo => "bar" })
654654
})
655655

656-
@client.notify(["test"], payload)
656+
res = @client.notify(["test"], payload)
657+
expect(res).to eq({foo: "bar"})
657658
end
658659

659660
it "should delete restricted gcm keys before sending a notification" do

0 commit comments

Comments
 (0)