beforeRequest hook doesn't work
See original GitHub issueHi guys! I noticed the next issue: When trying to change my json before sending, defined beforeRequest function is not called. Adding afterResponse function working as expected. My code looks like that:
{
"config": {
"target": "...my target...",
"phases": [
{"duration": 10, "arrivalRate": 5}
],
"processor" : "helloJS.js",
"defaults": {
"headers": {
"content-type": "application/json"
}
}
},
"scenarios": [
{
"flow": [
{
"post": {
"url": "...my url...",
"json": {
"my json"
},
"beforeRequest" : "foo"
}
}
]
}
]
}
module.exports = {
foo: foo
};
function foo (requestParams, context, ee, next) {
console.log("TEST");
return next();
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Intercept each request with before and after hooks
I have to make 5 requests (order doesn't matter) to 5 different endpoints. The URL of these endpoints is the same, except for...
Read more >Hooks - Fastify
The onResponse hook is executed when a response has been sent, so you will not be able to send more data to the...
Read more >axios-hooks - npm
In the example below we use the useAxios hook twice. Once to load the data when the component renders, and once to submit...
Read more >Cancel request before actual request #1012 - Issuehunt
Example (this is not working, it might just better illustrate what I want to do): ... @sindresorhus You can already modify options in...
Read more >Before request hook - Google Groups
I would like to check user credentials in every REST request, before any other hooks are triggered. The idea is to prevent any...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You’re welcome @hassy
As a suggestion this worked fine for me:
Regards
It needs to be set to an empty array if it’s not defined (and left alone if it’s an array). Easy fix. Thanks for investigating @danielo515!