File tree Expand file tree Collapse file tree 2 files changed +12
-12
lines changed
Expand file tree Collapse file tree 2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ package controllers
33import (
44 "fmt"
55 "io/ioutil"
6+ "log"
7+ "os"
8+ "os/exec"
69)
710
811func URLmethod () []string {
@@ -55,6 +58,14 @@ func GetHeader() []string {
5558 return args
5659}
5760
61+ func SendRequest (args []string ) {
62+ cmd := exec .Command ("curl" , args ... )
63+ log .Println ("curl " , args )
64+ cmd .Stdin = os .Stdin
65+ cmd .Stdout = os .Stdout
66+ cmd .Run ()
67+ }
68+
5869func loadFile (path string ) string {
5970 b , err := ioutil .ReadFile (path )
6071 checkErr (err )
Original file line number Diff line number Diff line change @@ -3,9 +3,6 @@ package main
33import (
44 "fmt"
55 "http-request-creator/controllers"
6- "log"
7- "os"
8- "os/exec"
96)
107
118func main () {
@@ -34,7 +31,7 @@ func main() {
3431 fmt .Scan (& option )
3532 if ynToBool (option ) {
3633 fmt .Println ("Sending request" )
37- sendRequest (args )
34+ controllers . SendRequest (args )
3835 } else {
3936 fmt .Println ("Do you want to save request to file? [y/n]" )
4037 fmt .Scan (& option )
@@ -54,11 +51,3 @@ func ynToBool(option string) bool {
5451 return false
5552 }
5653}
57-
58- func sendRequest (args []string ) {
59- cmd := exec .Command ("curl" , args ... )
60- log .Println ("curl " , args )
61- cmd .Stdin = os .Stdin
62- cmd .Stdout = os .Stdout
63- cmd .Run ()
64- }
You can’t perform that action at this time.
0 commit comments