We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 4b886f6 + 17030fa commit f64a39eCopy full SHA for f64a39e
unixhttp.go
@@ -4,6 +4,7 @@ import (
4
"flag"
5
"fmt"
6
"io"
7
+ "io/ioutil"
8
"net"
9
"net/http"
10
"net/http/httputil"
@@ -69,6 +70,24 @@ func main() {
69
70
if method == "GET" {
71
method = "POST"
72
}
73
+ // If data begins with @, it references a file
74
+ if (string(data[0]) == "@" && len(data) > 1) {
75
+ if (string(data[1:]) == "-") {
76
+ buf, err := ioutil.ReadAll(os.Stdin)
77
+ if (err != nil) {
78
+ fmt.Println("Failed to read from stdin:", err)
79
+ os.Exit(1)
80
+ }
81
+ reader = strings.NewReader(string(buf))
82
+ } else {
83
+ buf, err := ioutil.ReadFile(string(data[1:]))
84
85
+ fmt.Println("Failed to open file:", err)
86
87
88
89
90
91
92
93
query := ""
0 commit comments