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
refactor(monitoring): replace request with helix-fetch #95
Conversation
Statuspage tests with {
"error": "Could not authenticate"
} |
I have the same issue with POST requests. |
This PR will trigger no release when merged. |
Codecov Report
@@ Coverage Diff @@
## master #95 +/- ##
==========================================
- Coverage 94.47% 92.91% -1.57%
==========================================
Files 9 9
Lines 326 381 +55
==========================================
+ Hits 308 354 +46
- Misses 18 27 +9
Continue to review full report at Codecov.
|
@kptdobe, @stefan-guggisberg fixed it (thanks!) by moving the |
src/newrelic/alerts.js
Outdated
channel_ids: channelId, | ||
policy_id: policy.id, | ||
}, | ||
body: `channel_ids=${encodeURIComponent(channelId)}&policy_id=${encodeURIComponent(policy.id)}`, |
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.
If anyone knows of a more elegant way to submit url encoded form data, let me know 😄
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.
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.
Yup, URLSearchParams
. You also need to set the content-type: application/x-www-form-urlencoded
header.
The Fetch API allows both URLSearchParams
and FormData
as body: https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch#Body
helix-fetch
doesn't support it yet. Feel free to create a feature request issue.
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.
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.
See my comment. Apart from that LGTM.
Using |
Created adobe/fetch#67 |
🎉 This PR is included in version 1.11.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fix #93