Categorygithub.com/vsofin/xk6-raw-http
repositorypackage
0.5.1
Repository: https://github.com/vsofin/xk6-raw-http.git
Documentation: pkg.go.dev

# README

xk6-raw-http

Extension of the k6 for sending strings via HTTP and HTTPS in a raw format

Build

To build a k6 binary with this plugin, first ensure you have the prerequisites:

Then:

  1. Install xk6:
go install github.com/k6io/xk6/cmd/xk6@latest
  1. Build the binary:
xk6 build --with github.com/vsofin/xk6-raw-http@latest --output ./

Example 1

import worker from 'k6/x/raw-http';
import { check } from 'k6';

const conn = worker.connectTCP('host:port');

export default function () {
    worker.writeTCP(conn, 'Say Hello\n');
    let res = String.fromCharCode(...worker.readTCP(conn, 1024))
    check (res, {
        'verify ag tag': (res) => res.includes('Hello')
    });
    worker.closeTCP(conn);
}

Example 2

import worker from 'k6/x/raw-http';
import { check } from 'k6';

export default function () {
    const conn = worker.connectTLS('host:port');
}