yourWaifu / sleepy-discord

C++ library for the Discord chat client. Please use Rust for new bots
https://yourWaifu.github.io/sleepy-discord/
MIT License
707 stars 95 forks source link

Fix request response being copied before it is populated #181

Closed jaredoconnell closed 4 years ago

jaredoconnell commented 4 years ago

Before, the response object was being copied when the lambda was created. That resulted in the callback being called with a copy of the response that does not have the response information.

The fix is to make it by reference instead of copy. Since the lifetime of this object is the same as the function, that will always be valid.