How do I pass custom request headers (X-TRANSACTION-ID,X_USER_ID) in loopback for a POST API. We have the headers part in the data source file. But how do I make it dynamic ? I am using a remote method. Adding headers to the context object's request seems to make no difference. Only if the headers are added to the data source file , they seem to have an effect.
Passing Custom Request Headers in Loopback
2k Views Asked by Mayur Arora At
1
There are 1 best solutions below
Related Questions in STRONGLOOP
- How to setup Nginx as a load balancer using the StrongLoop Nginx Controller
- Impose max limit in Loopback
- Loopback: How to change the name of a model?
- hasMany relation: including from the other direction
- How do I incorporate a loopback application with cordova?
- StrongLoop: mutual Model Relations
- Filters - nin not working with near.
- LoopBack/Angular/Cordova timing out on Android
- Get full json struct in a belongsTo relation
- ARC won't load on Firefox 38.0.5
- ACL on certain records instead of API URLs
- How to publish multiple NPM modules from a single node project?
- StrongLoop: EmbedsMany vs hasMany and belongTo
- Passing Custom Request Headers in Loopback
- Expose Port for App via wercker.yml
Related Questions in LOOPBACK
- hasMany relation: including from the other direction
- StrongLoop: mutual Model Relations
- ACL on certain records instead of API URLs
- Loopback Angular SDK response code 401 intercept
- Passing Custom Request Headers in Loopback
- findById({}) in LoopBack
- Navigate through relationships in JSON response
- Get a custom JSON response from Loopback
- Not able to set up my loopback model.Error:Persisted model has not been correctly attached to a DataSource
- How can I edit the result of changeStream in loopback?
- Loopback AngularJS Get _id field from MongoDB Collection
- how could i receive xml through a remote method in loopback?
- Translate default error messages in Loopback
- Could not find a model with id
- Using lb-services count servcie in angular
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
for the related model, within its .js file, you can use a beforeRemote hook to modify the request before executing the remote method.
the context object(ctx) have access to both request/response. E.g: you should be able to access the request body with ctx.req.body