No results for

Powered byAlgolia

HTTP debugging

suggest edits

It's not always things work as expected. For those cases, enabling the --http-debug option will log HTTP requests and responses to help you debugging the script.

  • --http-debug logs the HTTP requests and responses, skipping the body.
  • --http-debug="full" logs the HTTP requests and responses, including the full body.

Example

Given the following script:

1import http from "k6/http";
2
3export default function() {
4 http.get("https://google.com/");
5}

If we run it using k6 run --http-debug script.js we get output that looks like this:

1 /\ |‾‾| /‾‾/ /‾/
2 /\ / \ | |_/ / / /
3 / \/ \ | | / ‾‾\
4 / \ | |\ \ | (_) |
5 / __________ \ |__| \__\ \___/ .io
6
7 execution: local
8 output: -
9 script: script.js
10
11 duration: -, iterations: 1
12 vus: 1, max: 1
13
14Request: [----------------------------------------------------------] starting
15
16GET / HTTP/1.1
17Host: google.com
18User-Agent: k6/0.20.0 (https://k6.io/);
19Accept-Encoding: gzip
20
21
22RedirectResponse:
23HTTP/2.0 302 Found
24Content-Length: 267
25Alt-Svc: hq=":443"; ma=2592000; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="42,41,39,35"
26Cache-Control: private
27Content-Type: text/html; charset=UTF-8
28Date: Thu, 22 Mar 2018 13:39:44 GMT
29Location: https://www.google.se/?gfe_rd=cr&dcr=0&ei=ILKzWqiODOaxX_LBi5AG
30Referrer-Policy: no-referrer
31
32
33RedirectRequest:
34GET /?gfe_rd=cr&dcr=0&ei=ILKzWqiODOaxX_LBi5AG HTTP/1.1
35Host: www.google.se
36User-Agent: k6/0.19.0 (https://k6.io/);
37Referer: https://google.com/
38Accept-Encoding: gzip
39
40
41Response:
42HTTP/2.0 200 OK
43Connection: close
44Accept-Ranges: none
45Alt-Svc: hq=":443"; ma=2592000; quic=51303432; quic=51303431; quic=51303339; quic=51303335,quic=":443"; ma=2592000; v="42,41,39,35"
46Cache-Control: private, max-age=0
47Content-Type: text/html; charset=ISO-8859-1
48Date: Thu, 22 Mar 2018 13:39:44 GMT
49Expires: -1
50P3p: CP="This is not a P3P policy! See g.co/p3phelp for more info."
51Server: gws
52Set-Cookie: 1P_JAR=2018-03-22-13; expires=Sat, 21-Apr-2018 13:39:44 GMT; path=/; domain=.google.se
53Set-Cookie: NID=126=asTcm5s3-jMa1-pquG09m9lpUrowy-OtzZ9cUomBuKeJePbvwJAZe5wCtiyLITj9_RrlWLf6DTQ8ufpdB39MCRV-zUpfXAUw8XUVMWtgdU1gbtnQ9rssin56333g9Hyo; expires=Fri, 21-Sep-2018 13:39:44 GMT; path=/; domain=.google.se; HttpOnly
54Vary: Accept-Encoding
55X-Frame-Options: SAMEORIGIN
56X-Xss-Protection: 1; mode=block
57
58...
59

See also