You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: body_uploader.go
    path of file: ./repos/gitlabhq/workhorse/internal/upload
    
    the code of the file until where you have to start completion: package upload

import (
	"fmt"
	"io"
	"net/http"
	"net/url"
	"strings"

	"gitlab.com/gitlab-org/gitlab/workhorse/internal/api"
	"gitlab.com/gitlab-org/gitlab/workhorse/internal/helper/fail"
	"gitlab.com/gitlab-org/gitlab/workhorse/internal/upload/destination"
)

// RequestBody is a request middleware. It will store 
    
func RequestBody(rails PreAuthorizer, h http.Handler, p Preparer) http.Handler {
	return rails.PreAuthorizeHandler(func(w http.ResponseWriter, r *http.Request, a *api.Response) {
		opts, err := p.Prepare(a)
		if err != nil {
			fail.Request(w, r, fmt.Errorf("RequestBody: preparation failed: %v", err))
			return
		}

		fh, err := destination.Upload(r.Context(), r.Body, r.ContentLength, "upload", opts)
		if err != nil {
			fail.Request(w, r, fmt.Errorf("RequestBody: upload failed: %v", err))
			return
		}

		data := url.Values{}
		fields, err := fh.GitLabFinalizeFields("file")
		if err != nil {
			fail.Request(w, r, fmt.Errorf("RequestBody: finalize fields failed: %v", err))
			return
		}

		for k, v := range fields {
			data.Set(k, v)
		}

		// Hijack body
		body := data.Encode()
		r.Body = io.NopCloser(strings.NewReader(body))
		r.ContentLength = int64(len(body))
		r.Header.Set("Content-Type", "application/x-www-form-urlencoded")

		sft := SavedFileTracker{Request: r}
		sft.Track("file", fh.LocalPath)
		if err := sft.Finalize(r.Context()); err != nil {
			fail.Request(w, r, fmt.Errorf("RequestBody: finalize failed: %v", err))
			return
		}

		// And proxy the request
		h.ServeHTTP(w, r)
	}, "/authorize")
}