blob: 8edbb1499679e16ae841003413cbe2f61f2617f5 [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001package main
2
3import (
4 "fmt"
5 "io"
6 "net/http"
7 "os"
8)
9
10func main() {
11 if len(os.Args) < 2 {
12 fmt.Println("arg expected")
13 os.Exit(1)
14 }
15
adrianvillinfbf5f2b2024-02-13 03:26:25 -050016 http.HandleFunc("/httpTestFile", func(w http.ResponseWriter, r *http.Request) {
17 file, _ := os.Open("httpTestFile")
Filip Tehlar229f5fc2022-08-09 14:44:47 +000018 defer file.Close()
19 io.Copy(w, file)
20 })
21 err := http.ListenAndServe(os.Args[1], nil)
22 if err != nil {
23 fmt.Printf("%v\n", err)
24 os.Exit(1)
25 }
26}