|
|
@ -2,7 +2,6 @@ package httpgetter
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"testing"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
@ -30,10 +29,4 @@ func TestGetHTMLMetaForInternal(t *testing.T) {
|
|
|
|
if _, err := GetHTMLMeta("http://localhost"); !errors.Is(err, ErrInternalIP) {
|
|
|
|
if _, err := GetHTMLMeta("http://localhost"); !errors.Is(err, ErrInternalIP) {
|
|
|
|
t.Errorf("Expected error for resolved internal IP, got %v", err)
|
|
|
|
t.Errorf("Expected error for resolved internal IP, got %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// test for redirected internal IP
|
|
|
|
|
|
|
|
// 49.232.126.226:1110 will redirects to 127.0.0.1
|
|
|
|
|
|
|
|
if _, err := GetHTMLMeta("http://49.232.126.226:1110"); !(errors.Is(err, ErrInternalIP) && strings.Contains(err.Error(), "redirect")) {
|
|
|
|
|
|
|
|
t.Errorf("Expected error for redirected internal IP, got %v", err)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|