If the target system indicates that a connection can be upgraded from HTTP/1.1 to HTTP/2, k6 will do so automatically.
1import http from 'k6/http';2import { check } from 'k6';3 4export default function () {5 const res = http.get('https://test-api.k6.io/');6 check(res, {7 'status is 200': (r) => r.status === 200,8 'protocol is HTTP/2': (r) => r.proto === 'HTTP/2.0',9 });10}