Is it possible to turn off have different options for the setup phase?

I am looking to make http requests during the setup phase to generate API Keys to use for tests. So I need the discardResponseBodies set to false.

However, after the setup phase I want to set that to true.

import http from 'k6/http';
import { getScenarios, addTestInfoMetrics } from "/helpers/tests.js";
import { generateKeys } from "/helpers/auth.js";

const { SCENARIO } = __ENV;
export const options = {
  discardResponseBodies: false,
  scenarios: { [SCENARIO]: getScenarios(${jsonencode(var.config)})[SCENARIO] },

export function setup() {
  if (${var.config.auth.enabled}) {
    return generateKeys("${}", ${var.config.auth.key_count})
  return {};

export default function (keys) {
  let headers = {};
  if (${var.config.auth.enabled}) {
    const i = Math.floor(Math.random() * keys.length);
    headers = { "Authorization": keys[i] }

  http.get('http://${var.url}/timestamp/json', { headers });

Is the only way to solve this to use a different http lib?

Got it, I just need to add { responseType: 'text' } to my requests inside generateKeys to override it :slight_smile: