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

141
Visualizações
K6 Use POST to login in

Ive been working with K6 recently and need to test my API, the login function needs a json in order to get the data but it does not get called on the run, heres my code for the script

import http from 'k6/http';
import { sleep } from 'k6';

export default function () {
  let strGlobalUrl = '192.168.0.1';
  let url = 'http://'+strGlobalUrl+'/api/CompanyLogin';
  let data = JSON.stringify({
    strEmail : 'email',
    strPassword : 'password',
    boolLoginPage : true 
  });

  let params = {
    headers: {
      'Content-Type': 'application/json',
      'dataType': 'json'
    }
  };

  let res = http.post(url, data, params);
  console.log(res.intResponse);
}

It should call the function and get print 200 on the console log, theres something I do wrong or is missing?

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

0

I got the answer from my boss, I forgot to include ':5050' in the value of strGlobalUrl due Im testing in my local copy of the server

I hope this would help someone else

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