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

103
Visualizações
Cypress Intercept, refining url

I'm intercepting a request with Cypress and I'm trying not to hardcode something. To make it work correctly, I have to add a "1" since I'm trying to intercept something like this:

/api/v1/contacts/cfs:12345/forms/144543

The problem is that there are other requests like /forms/something that are being intercepted if I use forms/**, leading to this:

let urlResponse = '/api/v1/contacts/cfs:' + $code + '/forms/1**'

Is there any regex or something that could let me just intercept the URL that's forms/number and not forms/something or forms/number/something?

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

0

Here is some regex for matching just the .../forms/number pattern.

const inputs = [
  '/api/v1/contacts/cfs:12345/forms/144543',
  '/api/v1/contacts/cfs:12345/forms/something',
  '/api/v1/contacts/cfs:12345/forms/144543/something'
];

const regex = new RegExp('/api/v1/contacts/cfs:12345/forms/[0-9]+$');

for (let input of inputs) {
  const isMatch = regex.test(input);
  console.log(isMatch);
}

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