@@ -16,8 +16,6 @@ import (
1616
1717var headersIncluded bool
1818var includeHeaders bool
19- var includeMethod bool
20- var includeUrl bool
2119var bodyFn string
2220var address string
2321var port int
@@ -26,8 +24,6 @@ var status int
2624func init () {
2725 Cmd .Flags ().BoolVarP (& headersIncluded , "include-headers" , "i" , false , "Read headers from the response body" )
2826 Cmd .Flags ().BoolVarP (& includeHeaders , "output-headers" , "o" , false , "Output request headers" )
29- Cmd .Flags ().BoolVarP (& includeMethod , "output-method" , "m" , false , "Output request method" )
30- Cmd .Flags ().BoolVarP (& includeUrl , "output-url" , "u" , false , "Output request URL" )
3127 Cmd .Flags ().StringVarP (& bodyFn , "body" , "b" , "" , "Filename to read the response body from. Use - or omit for stdin" )
3228 Cmd .Flags ().StringVarP (& address , "address" , "a" , "" , "Address to listen on" )
3329 Cmd .Flags ().IntVarP (& port , "port" , "p" , 8000 , "Port to listen on" )
@@ -47,8 +43,6 @@ var Cmd = &cobra.Command{
4743 handler := responder {
4844 status : status ,
4945 includeHeaders : includeHeaders ,
50- includeMethod : includeMethod ,
51- includeUrl : includeUrl ,
5246 headersIncluded : headersIncluded ,
5347 }
5448
@@ -74,6 +68,8 @@ var Cmd = &cobra.Command{
7468 }
7569 }()
7670
71+ fmt .Println ("Listening on" , address )
72+
7773 <- ch
7874
7975 server .Shutdown (context .Background ())
@@ -85,14 +81,12 @@ var ch chan bool
8581type responder struct {
8682 status int
8783 includeHeaders bool
88- includeMethod bool
89- includeUrl bool
9084 headersIncluded bool
9185 data io.Reader
9286}
9387
9488func (h responder ) ServeHTTP (w http.ResponseWriter , req * http.Request ) {
95- cobra .CheckErr (internal .PrintRequest (req , h .includeMethod , h . includeUrl , h . includeHeaders ))
89+ cobra .CheckErr (internal .PrintRequest (req , h .includeHeaders ))
9690
9791 inputReader := bufio .NewReader (h .data )
9892
0 commit comments