Skip to content

Commit 239bfc8

Browse files
committed
Export handler
1 parent d3233a0 commit 239bfc8

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// Main handler
14-
func handleProxy(w http.ResponseWriter, r *http.Request) {
14+
func HandleProxy(w http.ResponseWriter, r *http.Request) {
1515
// Auth first
1616
if !checkAuth(r) {
1717
w.Header().Set("Proxy-Authenticate", `Basic realm="Restricted"`)
@@ -142,7 +142,7 @@ func callAndLogError(f func() error) {
142142
func main() {
143143
server := &http.Server{
144144
Addr: ":8080", // listen on port 8080
145-
Handler: http.HandlerFunc(handleProxy),
145+
Handler: http.HandlerFunc(HandleProxy),
146146
}
147147

148148
// Check if port is available

main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ func TestHandleRequestAndRedirect(t *testing.T) {
7676
t.Setenv("PROXY_USER", "test-user")
7777
t.Setenv("PROXY_PASS", "valid-pass")
7878

79-
handleProxy(rr, req)
79+
HandleProxy(rr, req)
8080

8181
res := rr.Result()
8282

0 commit comments

Comments
 (0)