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.58k stars 210 forks source link

POST-file has not imported javascript file correctly #227

Closed allanclempe closed 11 months ago

allanclempe commented 1 year 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