-
Notifications
You must be signed in to change notification settings - Fork 0
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
184366331 Contify: subscribe_to_webhook returns :ok on error responses. #8
184366331 Contify: subscribe_to_webhook returns :ok on error responses. #8
Conversation
Update: Let me know if you see any issues. Cheers. |
lib/contify_api/connection.ex
Outdated
if Mix.env() == :test do | ||
[ | ||
{Tesla.Middleware.BaseUrl, base_url}, | ||
{Tesla.Middleware.Headers, [{"user-agent", user_agent}]}, | ||
{Tesla.Middleware.Headers, [{"APPSECRET", app_secret}]}, | ||
{Tesla.Middleware.Headers, [{"APPID", app_id}]}, | ||
{Tesla.Middleware.EncodeJson, engine: json_engine} | ||
| middleware | ||
] | ||
else | ||
timeout = Application.get_env(:contify, :timeout, @default_timeout) | ||
|
||
[ | ||
{Tesla.Middleware.BaseUrl, base_url}, | ||
{Tesla.Middleware.Headers, [{"user-agent", user_agent}]}, | ||
{Tesla.Middleware.Headers, [{"APPSECRET", app_secret}]}, | ||
{Tesla.Middleware.Headers, [{"APPID", app_id}]}, | ||
{Tesla.Middleware.Timeout, timeout: timeout}, | ||
{Tesla.Middleware.EncodeJson, engine: json_engine} | ||
| middleware | ||
] | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @crova I think it would be best here to check if timeout
is 0 and if so skip the Timeout Middleware.
And then put Application.put_env(:contify, :timeout, 0)
on the test_helpers.exs
? so that it gets configured as 0 before the test suite starts (I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback @imricardoramos, I'll make the change and see how that goes.
@imricardoramos , does this look better? |
yep, looks good. Does it work though? |
Verified that it works 👍 |
Comment
Let me know if you see any issues.
Manually tested with a couple of Enaia's existing webhooks and the returned response looked like what you specified:
Cheers.