add request headers to trigger functions#4012
add request headers to trigger functions#4012flovilmart merged 3 commits intoparse-community:masterfrom
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 |
flovilmart
left a comment
There was a problem hiding this comment.
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.