Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal k6 objects aren't properly encoded to JSON #803

Closed
na-- opened this issue Oct 10, 2018 · 1 comment
Closed

Internal k6 objects aren't properly encoded to JSON #803

na-- opened this issue Oct 10, 2018 · 1 comment
Assignees

Comments

@na--
Copy link
Member

na-- commented Oct 10, 2018

Most of the internal Go objects that are passed to the script like http.Response aren't marshalled to JSON properly, the Go structs simply lack the appropriate js tags. This is especially problematic when they are returned as part of a setup() result, since it is passed through JSON before the VUs and teardown() receive it. I've briefly mentioned about this in the comments of #558 and #693, but since they've been mostly closed by #799, I'm creating this separate issue just for this bug.

To demonstrate, this script:

import http from "k6/http";

export function setup() {
   return http.get("https://test.loadimpact.com");
}

export default function (data) {
   let resp = http.get("https://test.loadimpact.com");

   console.log(Object.keys(data))
   console.log(Object.keys(resp))
}

will output something like this:

INFO[0002] Headers,OCSP,Body,TLSVersion,Request,RemoteIP,RemotePort,TLSCipherSuite,Error,Proto,Cookies,Timings,URL,Status 
INFO[0002] remote_ip,remote_port,url,status,proto,headers,cookies,body,timings,tls_version,tls_cipher_suite,ocsp,error,request,clickLink,html,json,submitForm
@mstoykov
Copy link
Contributor

fixed by #804

@na-- na-- removed this from the v1.0.0 milestone Jul 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants