-
Notifications
You must be signed in to change notification settings - Fork 59
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
feat(fetchOEmbedData): Handle non-ok responses #104
Conversation
Codecov Report
@@ Coverage Diff @@
## master #104 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 179 182 +3
Branches 16 17 +1
=========================================
+ Hits 179 182 +3
Continue to review full report at Codecov.
|
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.
Looks really nice, thanks @pieh! 👊
🎉 This PR is included in version 1.14.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
Check OEmbed response status and throw if it's not
ok
(200-299 status range)Why:
Because plugin currently doesn't handle case of non-ok response and have potential to throw very confusing errors that are hard to track down to root cause. Having explicit handling allow us to throw actionable errors (by pointing which links are problematic)
How:
Adding check for
response.ok
and throwing if it's falsy.The change also added need to do some changes to existing tests, where I changed mocks to use actual
Response
object instead of fully mocked object (instead of addingok
andstatus
there).Checklist:
Closes #99
Closes #103