-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
add request headers to trigger functions #4012
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
add request headers to trigger functions #4012
Conversation
Hi @miguel-s , I was pretty sure you would have gone down that road and that's why we didn't implement it already, the req.config should 'per-request' so I believe this would be a better place to put those headers instead of a new parameter everywhere which could be very fragile. Could you factor the request headers in the Config, or a Config subclass so it's easier to manage in the future? |
Codecov Report
@@ Coverage Diff @@
## master #4012 +/- ##
==========================================
+ Coverage 90.59% 90.59% +<.01%
==========================================
Files 116 116
Lines 7793 7794 +1
==========================================
+ Hits 7060 7061 +1
Misses 733 733
Continue to review full report at Codecov.
|
From the outside, and from someone who doesn't know the implementation, it feels weird not to have the header in req.headers. |
@oallouch, this is already implemented in functions and jobs. Here it’s for the hooks |
Ah ok. Great. Just asking, do you plan to update the docs for things like this (like afterFind in the Guide and before/afterFind in the JS SDK API ref, for instance) ? |
If you wanna make a PR on the docs, go ahead!
|
@flovilmart just to make sure I understood you correctly, I could add the headers to the config object in the handleParseHeaders function in middlewares.js, would this be an acceptable solution? |
@miguel-s that would be better as I believe we create a new Config for each request |
I knew you would say that ! |
@flovilmart let me know what you think of the new approach |
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.
I like it, less intrusive, we'll refactor the Config at one point to be more practical :)
Now that this is merged in we can go ahead and close out #1461 ? |
Contributing to #1461
Adds the node request headers to the request object in Parse trigger functions.