I'm using fastify-cli. I already created a routed post. Its work normally when I call it from Postman, but not working when I call it from test command. It says FST_ERR_CTP_INVALID_MEDIA_TYPE. Where is my mistake?
const UserCreate = {
email: 'email@email.com',
password: bcrypt.hashSync('password', salt),
name: 'User Fullname',
username: 'cooluser',
initial: 'U',
roleId: 1,
status: 'active'
}
test(`create User`, async (t) => {
const app = build(t)
const res = await app.inject({
url: '/administrator/user',
method: 'POST',
payload: JSON.stringify(UserCreate),
headers: {
'Accept': 'application/json'
}
})
console.log(`res.payload`, res.payload)
t.equal(JSON.parse(res.payload).code, 200)
})