pusher / pusher-http-ruby

Ruby library for Pusher Channels HTTP API
https://pusher.com/channels
MIT License
664 stars 123 forks source link

Handling payload bigger than 10KB #136

Closed yarcub closed 5 years ago

yarcub commented 6 years ago

Hi šŸ‘‹

I'm trying to handle failure calls to trigger due to message exceeding 10KB. From my understanding REST API will respond with a 413 HTTP status code but this library doesn't expose it.

  1. the status is not exposed on the trigger returned value
  2. neither as a specific error

https://github.com/pusher/pusher-http-ruby/blob/86e613ffb887d9e4d386b1cdc005dde1757449f6/lib/pusher/request.rb#L83-L100

It raises an unknown error with the message Unknown error (status code 413): #{body}

Imo, it's a know error (payload too big) and now the only way we can correctly handle/report it is by checking if the message for (status code 413) which seems far from ideal.

What are you thoughts on this? Should it raise a more specific error?

annzenkina commented 5 years ago

Iā€™m really sorry for such a delay in getting back to you and thanks for submitting an issue. This issue was fixed in the latest versions of the library: https://github.com/pusher/pusher-http-ruby/blob/master/lib/pusher/request.rb#L83-L100, therefore Iā€™m going to close it.