go-upload-demo

module
v0.0.0-...-4ccf166 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2020 License: MIT

README

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

Directories

Path Synopsis
cmd
serve-echo command
upload-buffered command
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL