go-upload-demo

go-upload-demo

Demonstrates how to make an optimal HTTP request with the multipart MIME message according to RFC7578 in Go. It uploads a file including metadata to an echoing server, which just prints the request header and body on the console.

The best solutions for both chunked and sized (with content length) are upload-composed-chunked and upload-composed-sized, which use a custom multipart composer. Other solutions use the standard multipart writer.

Command line executables; see the descriptions pointed at by these links:

The server and the uploading executables use common parameters and common request & response handling to make the testing easier.

Usage

Install Go and GNU Make. For example, on Mac:

brew install go make

Clone this repository and build the executable:

git clone https://github.com/prantlf/go-upload-demo.git
cd go-upload-demo
make

Run the testing web server, which prints requests on the console, in the background:

./serve-echo &

Run the testing clients, which use different techniques to send a multi-part form request:

./upload-buffered
./upload-piped-chunked
./upload-piped-sized
./upload-composed-chunked
./upload-composed-sized

Visit original content creator repository
https://github.com/prantlf/go-upload-demo

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *