Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

147
Visualizações
Express Typescript Prevent Unwanted Data In Post Request

the post request has content_Name,content_Type, content_Json.

Those are the field that should be sent, but if i add a property ill be able to send a request with an unwanted datafield how can i prevent that:

enter image description here

DTO:

content_name,
content_type,
Content_json,

Json Request (Example) sent

{
  "this_field_shouldnt_be_available" : "Zebb"
}

Request received

{
  "this_field_shouldnt_be_available" : "Zebb",
  content_name: null,
  content_type: null,
  Content_json: null
}

How can I have an exception to use a "DTO" to only allow the valid data is it possible without schema? just comparing to DTO?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can add a middleware with a validation to verify each property key that must exist in the DTO, and then validate the quantity of keys of the DTO assuring that it is not greater than the keys you set to be there

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda