From e40367d9040b29c3bc3ece1cea356352e9b03dfd Mon Sep 17 00:00:00 2001 From: foxcores <116920930+foxcores@users.noreply.github.com> Date: Wed, 2 Nov 2022 09:33:19 +0100 Subject: [PATCH] Updating httpx as a library integration test (#847) * Update library.go Go 1.18 + Some missing tests #826 * using standard http lib Co-authored-by: Mzack9999 --- cmd/integration-test/library.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/integration-test/library.go b/cmd/integration-test/library.go index f20e4bf..a81432a 100644 --- a/cmd/integration-test/library.go +++ b/cmd/integration-test/library.go @@ -1,6 +1,7 @@ package main import ( + "net/http" "os" "github.com/projectdiscovery/httpx/internal/testutils" @@ -22,9 +23,14 @@ func (h *httpxLibrary) Execute() error { } defer os.RemoveAll(testFile) + var got string + options := runner.Options{ - Methods: "GET", + Methods: http.MethodGet, InputFile: testFile, + OnResult: func(r runner.Result) { + got = r.URL + }, } if err := options.ValidateOptions(); err != nil { return err @@ -37,5 +43,12 @@ func (h *httpxLibrary) Execute() error { defer httpxRunner.Close() httpxRunner.RunEnumeration() + + expected := "https://scanme.sh:443" + + if got != expected { + return errIncorrectResult(expected, got) + } + return nil }