Knowledgebase

Load Testing with HTTP/2


Background

Information on how to load test HTTP/2 with LoadImpact.


HTTP/2

In k6 HTTP/2 is automatic. If the target system indicates that a connection can be upgraded from HTTP/1.1 to HTTP/2, k6 will do so automatically.

Making HTTP/2 requests

1
2
3
4
5
6
7
8
9
10
import http from "k6/http";
import { check } from "k6";

export default function() {
    let res = http.get("https://www.bbc.co.uk/");
    check(res, {
        "status is 200": (r) => r.status === 200,
        "protocol is HTTP/2": (r) => r.proto === "HTTP/2.0",
    });
}