<commit_before>package http

import (
	log "github.com/Sirupsen/logrus"
	"github.com/loadimpact/speedboat/runner"
	"github.com/valyala/fasthttp"
	"math"
	"time"
)

type context struct {
	client *fasthttp.Client
}

type RequestArgs struct {
	Follow bool `json:"follow"`
	Report bool `json:"report"`
}

func New() map[string]interface{} {
	ctx := &context{
		client: &fasthttp.Client{
			Dial:                fasthttp.Dial,
			MaxIdleConnDuration: time.Duration(0),
			MaxConnsPerHost:     math.MaxInt64,
		},
	}
	return map[string]interface{}{
		"get":     ctx.Get,
		"request": ctx.Request,
	}
}

func (ctx *context) Get(url string, args RequestArgs) <-chan runner.Result {
	return ctx.Request("GET", url, args)
}

func (ctx *context) Request(method, url string, args RequestArgs) <-chan runner.Result {
	log.WithFields(log.Fields{
		"follow": args.Follow,
		"report": args.Report,
	}).Info("Aaaa")
	ch := make(chan runner.Result, 1)
	go func() {
		defer close(ch)

		req := fasthttp.AcquireRequest()
		defer fasthttp.ReleaseRequest(req)

		res := fasthttp.AcquireResponse()
		defer fasthttp.ReleaseResponse(res)

		req.SetRequestURI(url)
		req.Header.SetMethod(method)

		startTime := time.Now()
		err := ctx.client.Do(req, res)
		duration := time.Since(startTime)

		ch <- runner.Result{Error: err, Time: duration}
	}()
	return ch
}<commit_msg>POST + bodies<commit_after>package http

import (
	log "github.com/Sirupsen/logrus"
	"github.com/loadimpact/speedboat/runner"
	"github.com/valyala/fasthttp"
	"math"
	"time"
)

type context struct {
	client *fasthttp.Client
}

type RequestArgs struct {
	Follow bool `json:"follow"`
	Report bool `json:"report"`
}

func New() map[string]interface{} {
	ctx := &context{
		client: &fasthttp.Client{
			Dial:                fasthttp.Dial,
			MaxIdleConnDuration: time.Duration(0),
			MaxConnsPerHost:     math.MaxInt64,
		},
	}
	return map[string]interface{}{
		"get":     ctx.Get,
		"post":    ctx.Post,
		"request": ctx.Request,
	}
}

func (ctx *context) Get(url string, args RequestArgs) <-chan runner.Result {
	return ctx.Request("GET", url, "", args)
}

func (ctx *context) Post(url, body string, args RequestArgs) <-chan runner.Result {
	return ctx.Request("POST", url, body, args)
}

func (ctx *context) Request(method, url, body string, args RequestArgs) <-chan runner.Result {
	log.WithFields(log.Fields{
		"method": method,
		"url":    url,
		"follow": args.Follow,
		"report": args.Report,
	}).Debug("Request")
	ch := make(chan runner.Result, 1)
	go func() {
		defer close(ch)

		req := fasthttp.AcquireRequest()
		defer fasthttp.ReleaseRequest(req)

		res := fasthttp.AcquireResponse()
		defer fasthttp.ReleaseResponse(res)

		req.SetRequestURI(url)
		req.Header.SetMethod(method)
		req.SetBodyString(body)

		startTime := time.Now()
		err := ctx.client.Do(req, res)
		duration := time.Since(startTime)

		ch <- runner.Result{Error: err, Time: duration}
	}()
	return ch
}
{'fraction_non_alphanumeric': 0.15082079343365254, 'fraction_numerical': 0.0027359781121751026, 'mean_word_length': 4.060553633217993, 'pattern_counts': {'":': 11, '<': 10, '<?xml version=': 0, '>': 3, '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': '4113418', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1026, 'n_words': 230}