<commit_before>const { Request, Storage, Utils } = require('../support/index');
const { defineSupportCode } = require('cucumber');

defineSupportCode(({ Given }) => {
    Given(/^I set (.*) header to (.*)$/, (headerName, headerValue, callback) => {
        Request.setRequestHeader(
            Utils.replaceVariables(headerName),
            Utils.replaceVariables(headerValue)
        );
        callback();
    });

    Given(/^I set cookie to (.*)$/, (cookie, callback) => {
        Request.setCookie(cookie);
        callback();
    });

    Given(/^I set headers to$/, (headers, callback) => {
        headers.hashes().forEach((h) => {
            Request.setRequestHeader(
                Utils.replaceVariables(h.name),
                Utils.replaceVariables(h.value)
            );
        });
        callback();
    });

    Given(/^I set body to (.*)$/, (bodyValue, callback) => {
        Request.setRequestBody(Utils.replaceVariables(bodyValue));
        callback();
    });

    Given(/^I pipe contents of file (.*) to body$/, (file, callback) => {
        Utils.pipeFileContentsToRequestBody(file, (err, data) => {
            if (err) throw err;
            Request.setRequestBody(Utils.replaceVariables(data));
            callback();
        });
    });

    Given(/^I pipe contents of file (.*) as (.*) in global scope$/, (file, name, callback) => {
        Utils.pipeFileContentsToRequestBody(Utils.replaceVariables(file), (err, data) => {
            if (err) throw err;
            Storage.setGlobalVariable(name, data);
            callback();
        });
    });

    Given(/^I set query parameters to$/, (table, callback) => {
        table.hashes().forEach((t) => {
            Request.setQueryParameters(
                Utils.replaceVariables(t.name),
                Utils.replaceVariables(t.value)<commit_msg>fix replace I pipe contents of file (.*) to body<commit_after>const { Request, Storage, Utils } = require('../support/index');
const { defineSupportCode } = require('cucumber');

defineSupportCode(({ Given }) => {
    Given(/^I set (.*) header to (.*)$/, (headerName, headerValue, callback) => {
        Request.setRequestHeader(
            Utils.replaceVariables(headerName),
            Utils.replaceVariables(headerValue)
        );
        callback();
    });

    Given(/^I set cookie to (.*)$/, (cookie, callback) => {
        Request.setCookie(cookie);
        callback();
    });

    Given(/^I set headers to$/, (headers, callback) => {
        headers.hashes().forEach((h) => {
            Request.setRequestHeader(
                Utils.replaceVariables(h.name),
                Utils.replaceVariables(h.value)
            );
        });
        callback();
    });

    Given(/^I set body to (.*)$/, (bodyValue, callback) => {
        Request.setRequestBody(Utils.replaceVariables(bodyValue));
        callback();
    });

    Given(/^I pipe contents of file (.*) to body$/, (file, callback) => {
        Utils.pipeFileContentsToRequestBody(Utils.replaceVariables(file), (err, data) => {
            if (err) throw err;
            Request.setRequestBody(Utils.replaceVariables(data));
            callback();
        });
    });

    Given(/^I pipe contents of file (.*) as (.*) in global scope$/, (file, name, callback) => {
        Utils.pipeFileContentsToRequestBody(Utils.replaceVariables(file), (err, data) => {
            if (err) throw err;
            Storage.setGlobalVariable(name, data);
            callback();
        });
    });

    Given(/^I set query parameters to$/, (table, callback) => {
        table.hashes().forEach((t) => {
            Request.setQueryParameters(
                Utils.replaceVariables(t.name),
                Utils.replaceVariables(t.value)
{'fraction_non_alphanumeric': 0.16082419052716082, 'fraction_numerical': 0.0, 'mean_word_length': 2.227979274611399, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4356468', 'n_tokens_mistral': 1045, 'n_tokens_neox': 998, 'n_words': 205}