forked from openfaas/faas-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
--mock-http working, replaces http client with fake client, returns d…
…ummy zip file Signed-off-by: Eric Stoekl <ems5311@gmail.com>
- Loading branch information
1 parent
003bd75
commit 16585bc
Showing
3 changed files
with
46 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package commands | ||
|
||
import ( | ||
"net/http" | ||
"io/ioutil" | ||
"bytes" | ||
"log" | ||
) | ||
|
||
type ClientMock struct { | ||
} | ||
|
||
func (c *ClientMock) Do(req *http.Request) (*http.Response, error) { | ||
log.Printf("hi from ClientMock Do()") | ||
zip := []byte{80, 75, 05, 06, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00} | ||
|
||
resp := http.Response{ | ||
Body: ioutil.NopCloser(bytes.NewBuffer(zip)), | ||
} | ||
return &resp, nil | ||
} | ||
|
||
type HttpClient interface { | ||
Do(req *http.Request) (*http.Response, error) | ||
} |