Merge 293146f2a83aca567d6b39502e054fb745467ffd into e80f5ac9dddc132b91479e7d5a078f01c0504325

This commit is contained in:
k3-cat 2024-04-21 15:12:34 +00:00 committed by GitHub
commit 0a5e5d1121
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -52,6 +52,7 @@ type HTTPRequest interface {
type HTTPResponse interface { type HTTPResponse interface {
GetContent() ([]byte, error) GetContent() ([]byte, error)
GetContentString() (string, error) GetContentString() (string, error)
GetFinalURL() string
WriteTo(path string) error WriteTo(path string) error
} }
@ -233,6 +234,11 @@ func (h *httpResponse) GetContentString() (string, error) {
return string(content), nil return string(content), nil
} }
func (h *httpResponse) GetFinalURL() string {
finalURL := h.Request.URL.String()
return finalURL
}
func (h *httpResponse) WriteTo(path string) error { func (h *httpResponse) WriteTo(path string) error {
defer h.Body.Close() defer h.Body.Close()
file, err := os.Create(path) file, err := os.Create(path)