Skip to content
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

fix(ifttt): treat all 2xx http responses as success #373

Merged
merged 2 commits into from
Jul 12, 2023

Conversation

eoleedi
Copy link
Contributor

@eoleedi eoleedi commented Jul 6, 2023

Originally, shoutrrr sees only http status code 204 as a successful response from IFTTT webhook service.
However, http status code 200 should be also seen has a successful response.

This prevents an incorrect error log from generating.

@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (11cd546) 78.95% compared to head (0f3fce1) 78.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #373   +/-   ##
=======================================
  Coverage   78.95%   78.95%           
=======================================
  Files         101      101           
  Lines        4438     4438           
=======================================
  Hits         3504     3504           
  Misses        756      756           
  Partials      178      178           
Impacted Files Coverage Δ
pkg/services/ifttt/ifttt.go 78.57% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@piksel
Copy link
Member

piksel commented Jul 7, 2023

I tried looking at the documentation to find what status codes are expected, but I couldn't find any explicit documentation. It seems like the service is using this:
https://ifttt.com/maker_webhooks/triggers/event

There is some documentation at https://maker.ifttt.com/use/your-key but it doesn't contain any response statuses. While testing, it does indeed now return 200 with the text body of Congratulations! You've fired the <EVENT_NAME> event. Perhaps they changed this behaviour?

@eoleedi
Copy link
Contributor Author

eoleedi commented Jul 7, 2023

I also didn't find any explicit documentation.
Since it is a service provided by IFTTT, maybe we can assume that the API follows the General API requirements of IFTTT.
https://ifttt.com/docs/api_reference

Dig deeper into the OpenAPI of IFTTT
There is a similar but not the exact same API endpoint, where 200 is used.
https://github.com/IFTTT/service-api/blob/99218c72a9564b842f30e367de0f2fe0f450f3b7/service-api.yaml#L331C1-L365C60

If that's the case, should we keep 204 as successful response just in case?

@piksel
Copy link
Member

piksel commented Jul 8, 2023

Yeah, any 2xx status denotes a success, so we should never treat those as errors anyway.

@piksel piksel changed the title Fix incorrect http response error condition in IFTTT service fix(ifttt): treat all 2xx http responses as success Jul 12, 2023
@piksel piksel merged commit 677162d into containrrr:main Jul 12, 2023
7 checks passed
@eoleedi eoleedi deleted the fix/ifttt-service branch October 22, 2023 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants