Open JyotiPMallick opened 1 week ago
Hello @JyotiPMallick , is the RegisterCompany
is a data template?
If so, we need to use @DATA:TEMPLATE@
. For example:
spec.withMultiPartFormData({ '@DATA:TEMPLATE@': 'RegisterCompany' })
You mean something like spec.withMultiPartFormData({ companyDto: {"@DATA:TEMPLATE@": "RegisterCompany" }});
?
addSpecHandler("Register a new company", ({ spec }) => {
spec.post(paths.COMPANY_REGISTRATION);
spec.withMultiPartFormData({ companyDto: {"@DATA:TEMPLATE@": "RegisterCompany" }});
spec.expectStatus(200);
});
I am getting TypeError: source.on is not a function
error.
Can you please share the stack trace of the error.
Registering a new company should return expected http status code 200 proper data in the response time.:
TypeError: source.on is not a function
at DelayedStream.create (node_modules\delayed-stream\lib\delayed_stream.js:33:10)
at CombinedStream.append (node_modules\combined-stream\lib\combined_stream.js:45:37)
at FormData.append (node_modules\form-data-lite\src\index.js:75:3)
at setMultiPartFormData (node_modules\pactum\src\helpers\requestProcessor.js:134:34)
at Object.process (node_modules\pactum\src\helpers\requestProcessor.js:22:5)
at Tosser.toss (node_modules\pactum\src\models\Tosser.js:32:39)
at Spec.toss (node_modules\pactum\src\models\Spec.js:540:19)
at Spec.then (node_modules\pactum\src\models\Spec.js:544:10)
Here it is
Describe the bug
I am trying to make a post call with accept multipart form data, and one of its parameters (this one is mandatory) is only accepting JSON payload. But the spec handler is unable to identify the JSON data.
To Reproduce Steps to reproduce the behavior:
My spec handler :
My JSON payload which contains some synthetic data produced through function,
Now while running I am getting the below error,
Same thing from the browser
Expected behavior It should add the details.
Software (please complete the following information):
Any clue what I am missing here ?