Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

140
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!