1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

NS1: Improve NS1_URLFWD handling (#2015)

This commit is contained in:
Costas Drogos
2023-01-30 04:01:41 +01:00
committed by GitHub
parent 947efef612
commit 7ed849d10d
4 changed files with 41 additions and 3 deletions

View File

@ -199,6 +199,28 @@ func TestNSAtRoot(t *testing.T) {
}
}
func TestURLFWDValid(t *testing.T) {
rec := &models.RecordConfig{Type: "URLFWD"}
rec.SetLabel("test1", "foo.com")
rec.SetTarget("/ http://example.com 302 2 0")
errs := checkTargets(rec, "foo.com")
if len(errs) > 0 {
t.Error("Expect no error with valid URLFWD target")
}
}
func TestURLFWDInvalid(t *testing.T) {
rec := &models.RecordConfig{Type: "URLFWD"}
rec.SetLabel("test2", "foo.com")
rec.SetTarget("/ http://example.com 302 2")
errs := checkTargets(rec, "foo.com")
if len(errs) == 0 {
t.Error("Expect error with invalid URLFWD target")
}
}
func TestTransforms(t *testing.T) {
var tests = []struct {
givenIP string