When I make a POST
request in Chrome to my NodeJS Fastify server, Chrome's network tab displays one post request:
However, Fastify logs two requests each with a unique request ID:
Now, what is crazy is that when I perform the same request in Firefox, Fastify only logs one request... So is this a Chrome issue or a Fastify/NodeJS one?
Front-end POST
request:
const response = await fetch('/api/signupForm', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
foo: bar,
})
}).then(response => response.json()).catch(error => {
...
});
Fastify request:
fastify.post('/signupForm', {
body: {
type: 'object',
required: ['foo'],
properties: {
foo: {
type: 'string'
}
}
},
//Output Serialization
schema: {
response: {
200: {
type: 'object',
properties: {
success: {
type: 'boolean'
}
}
}
}
},
}, async (req, reply) => {
console.log('route started..............................................................');
...