package doh import ( "net/http" "testing" "github.com/miekg/dns" ) func TestDoH(t *testing.T) { tests := map[string]struct { method string url string }{ "POST request over HTTPS": {method: http.MethodPost, url: "https://example.org:443"}, "POST request over HTTP": {method: http.MethodPost, url: "http://example.org:443"}, "POST request without protocol": {method: http.MethodPost, url: "example.org:443"}, "GET request over HTTPS": {method: http.MethodGet, url: "https://example.org:443"}, "GET request over HTTP": {method: http.MethodGet, url: "http://example.org"}, "GET request without protocol": {method: http.MethodGet, url: "example.org:443"}, } for name, test := range tests { t.Run(name, func(t *testing.T) { m := new(dns.Msg) m.SetQuestion("example.org.", dns.TypeDNSKEY) req, err := NewRequest(test.method, test.url, m) if err != nil { t.Errorf("Failure to make request: %s", err) } m, err = RequestToMsg(req) if err != nil { t.Fatalf("Failure to get message from request: %s", err) } if x := m.Question[0].Name; x != "example.org." { t.Errorf("Qname expected %s, got %s", "example.org.", x) } if x := m.Question[0].Qtype; x != dns.TypeDNSKEY { t.Errorf("Qname expected %d, got %d", x, dns.TypeDNSKEY) } }) } } tion> Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
path: root/src/flags.zig (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2021-05-29micropGravatar Jarred Sumner 7-25/+92
2021-05-29fix crashGravatar Jarred Sumner 1-1/+1
2021-05-29microp-optimize hash table stuffGravatar Jarred Sumner 1-4/+36
2021-05-29Move wyhasxhGravatar Jarred Sumner 1-0/+0
2021-05-282Gravatar Jarred Sumner 1-1/+4
2021-05-28allGravatar Jarred Sumner 14-89/+591
2021-05-28wGravatar Jarred Sumner 1-1/+4