meu projeto deu erro a pos a inserção da ferramento de formatosAceitos.
const formatosAceitos = require('./Serializador').formatosAceitos
app.use(bodyParder.json())
app.use((requisicao, resposta, proximo) => { let formatoRequisitado = requisicao.header('Accept')
if (formatosAceitos.indexOf(formatoRequisitado) === -1) {
resposta.status(406)
resposta.end()
}
resposta.setHeader('Content-Type', formatoRequisitado)
proximo()
})
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (httpoutgoing.js:558:11) at ServerResponse.header (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\response.js:771:10) at ServerResponse.contentType (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\response.js:599:15) at ServerResponse.send (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\response.js:145:14) at C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\api\index.js:43:14 at Layer.handle_error (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\router\layer.js:71:5) at trim_prefix (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\router\index.js:315:13) at C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\router\index.js:284:7 at Function.process_params (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\router\index.js:335:12) at next (C:\Users\mnsfreis\Desktop\CURSO ALURA\api-petshop\node_modules\express\lib\router\index.js:275:10)