<commit_before>package http

import "net/http"

type Transport struct {
	http.Transport
}

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
	var (
		err      error
		backend  *backend
		response *http.Response
		service  = req.URL.Host
	)

	for i := 0; i <= _balancer.countOfBackends(service)*2; i++ {
		if backend, err = _balancer.next(service); err == nil {
			req.URL.Host = backend.address
			if response, err = t.Transport.RoundTrip(req); err == nil {
				return response, nil
			}
			backend.skip()
		}
	}
	return nil, err
}
<commit_msg>save request body for failback requests<commit_after>package http

import (
	"bytes"
	"io/ioutil"
	"net/http"
)

type Transport struct {
	http.Transport
}

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error) {
	var (
		err      error
		backend  *backend
		response *http.Response
		service  = req.URL.Host
	)
	body, _ := ioutil.ReadAll(req.Body)
	for i := 0; i <= _balancer.countOfBackends(service)*2; i++ {
		if backend, err = _balancer.next(service); err == nil {
			req.URL.Host = backend.address
			req.Body = ioutil.NopCloser(bytes.NewBuffer(body))
			if response, err = t.Transport.RoundTrip(req); err == nil {
				return response, nil
			}
			backend.skip()
		}
	}
	return nil, err
}

{'fraction_non_alphanumeric': 0.13427010148321625, 'fraction_numerical': 0.00312256049960968, 'mean_word_length': 3.4054982817869415, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6920874', 'n_tokens_mistral': 500, 'n_tokens_neox': 460, 'n_words': 113}