API Post request with body as array
What is your Scenario?
I have an Api endpoint which will accept input as array. When I'm executing my request, It gets stuck at API execution and doesn't fulfill the request.
What is the Current behavior?
When I'm executing my request, It gets stuck at API execution and doesn't fulfill the request.
What is the Expected behavior?
It should create a user
What is your public website URL? (or attach your complete example)
const config = require("../config"); const path = "/users";
fixtureApi tests
test('test 1', async t => {
const response = await t.request({
url: config.baseUrl + '/users',
protocol: "https",
method: "post",
auth: {
username: "user",
password: "pass"
},
headers: {
"content-type": 'application/json'
},
body:
[
{
"email": "[email protected]",
"properties": { "title": "Test User2" }
}
]
});
console.log(response);
});
What is your TestCafe test code?
fixtureApi tests
test('test 1', async t => {
const response = await t.request({
url: config.baseUrl + '/users',
protocol: "https",
method: "post",
auth: {
username: "user",
password: "pass"
},
headers: {
"content-type": 'application/json'
},
body:
[
{
"email": "[email protected]",
"properties": { "title": "Test User2" }
}
]
});
console.log(response);
});
Your complete configuration file
No response
Your complete test report
No response
Screenshots
No response
Steps to Reproduce
- Post request with body as json array Ex: body: [ {"user":test1} ]
TestCafe version
1.20.0
Node.js version
v16.10.0
Command-line arguments
testcafe chrome:headless ./tests/*.test.js
Browser name(s) and version(s)
No response
Platform(s) and version(s)
macOS 11.6.5
Other
No response
Thank you for submitting this issue. We would love to assist you and diagnose it. However, we need a simple sample that we can easily run on our side in order to replicate the issue and research its cause. Without a sample, we are not able to figure out what's going on and why this issue occurs. Refer to this article to create the best example: How To: Create a Minimal Working Example When You Submit an Issue. We look forward to your response.
This issue was automatically closed because there was no response to our request for more information from the original author. Currently, we don't have enough information to take action. Please reach out to us if you find the necessary information and are able to share it. We are also eager to know if you resolved the issue on your own and can share your findings with everyone.