Skip to content

Commit 45a3692

Browse files
committed
Update recorder_test
To ensure we use a safe port and ignore the result file in git.
1 parent 135a896 commit 45a3692

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
*.so
1313
*.dylib
1414

15+
# Test artifacts
16+
httpmock-record.yml
17+
1518
# Test binary, built with `go test -c`
1619
*.test
1720

http/mock/recorder_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ func ExampleActivateRecorder() {
2828
// Start a simple HTTP server
2929
runHTTP()
3030

31-
resp, err := http.Get("http://localhost:8080/test") // nolint:noctx
31+
// Do any HTTP request
32+
resp, err := http.Get("http://localhost:64888/test") // nolint:noctx
3233
if err != nil {
3334
fmt.Println(err)
3435
os.Exit(1)
@@ -47,7 +48,7 @@ func ExampleActivateRecorder() {
4748
// Output:
4849
// Hello World
4950
// ---
50-
// url: http://localhost:8080/test
51+
// url: http://localhost:64888/test
5152
// method: GET
5253
// query: ""
5354
// status: 200 OK
@@ -59,5 +60,5 @@ func runHTTP() {
5960
_, _ = io.WriteString(w, `Hello World`)
6061
})
6162

62-
go http.ListenAndServe(":8080", nil) //nolint:errcheck
63+
go http.ListenAndServe(":64888", nil) //nolint:errcheck
6364
}

0 commit comments

Comments
 (0)