alexfernandez / loadtest

Runs a load test on the selected URL. Fast and easy to use. Can be integrated in your own workflow using the API.
MIT License
2.57k stars 209 forks source link

POST-file has not imported javascript file correctly #227

Closed allanclempe closed 10 months ago

allanclempe commented 10 months ago

Problem: When passed -p (POST-file) as .js file, the function does not get evaluated, hence the body is null.

loadtest -T "application/json"  -p sample/post-file.js https://localhost:3000/api/sale

sample/post-file.js

export default (requestId) => {
    return {
        key: 'value',
        requestId: requestId
    }
}

Cause: Dynamic import expects a function but was an object

Node version v18.17.1