-
Notifications
You must be signed in to change notification settings - Fork 56
Closed
Labels
difficulty: mediumfix is medium in difficultyfix is medium in difficultystatus: work in progressTwilio or the community is in the process of implementingTwilio or the community is in the process of implementingtype: bugbug in the librarybug in the library
Description
Issue Summary
Reusing the Sendgrid client causes a 404.
Steps to Reproduce
If you try to reuse a client with a path multiple times it fails on subsequent attempts:
mail = SendGrid::Mail.new
[ ... do some mail setup ...]
client = SendGrid::API.new(api_key: API_KEY, host: 'https://api.sendgrid.com').client.mail
client._('send').post(request_body: mail.to_json) # This succeeds
client._('send').post(request_body: mail.to_json) # This fails
if instead you move the clients #mail
method to be called twice things work:
mail = SendGrid::Mail.new
[ ... do some mail setup ...]
client = SendGrid::API.new(api_key: API_KEY, host: 'https://api.sendgrid.com').client
client.mail._('send').post(request_body: mail.to_json) # This succeeds
client.mail._('send').post(request_body: mail.to_json) # This succeeds
This is very unexpected behaviour, the code should not require you to call mail
over an over. Instead you should be able to reuse the same client instance over and over.
Technical details:
- ruby-http-client Version: 3.3.0
- Ruby Version: 2.5
Metadata
Metadata
Assignees
Labels
difficulty: mediumfix is medium in difficultyfix is medium in difficultystatus: work in progressTwilio or the community is in the process of implementingTwilio or the community is in the process of implementingtype: bugbug in the librarybug in the library