I am using axios for post request which is giving me correct response data but with an additional field
[[Prototype]]: Object.
I don't want this in my apis. By testing with postman, this additional field is not showing. Why Axios is giving me this additional field and how I can get rid of it?
Here is my react code.
const submitHandler = (event) => {
event.preventDefault();
let name = event.target.name.value;
let head = parseInt(event.target.head.value);
console.log(name, head);
const body = {
name: name,
flag: 1,
accountNumber: 100,
headNo: head,
sumDebit: 0,
sumCredit: 0,
};
axios
.post("http://localhost:5000/api/accounts/create", body)
.then((res)=>{console.log (res.data);})
.catch((err) => console.log(err));
};
Here is my express code. I am only using these middlewares.
app.use(cors({origin:true,credentials:false}));
app.use(express.json({ extended: true }));
app.use("/api/accounts", account_route);
app.use("/api/transaction", transaction_route);
app.use("/api/account-info", accounts_route);
My Api code is sent in this format.
res.json(reqData);