Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove old testcase and use a compatible splicing method #185

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions speedtest/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"math"
"net/http"
"net/url"
"path"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -76,15 +75,13 @@ func (s *Speedtest) CustomServer(host string) (*Server, error) {
if err != nil {
return nil, err
}
if path.Base(u.Path) != "upload.php" {
return nil, errors.New("please use the full URL of the server, ending in '/upload.php'")
}
parseHost := fmt.Sprintf("%s://%s%s", u.Scheme, u.Host, "/speedtest/upload.php")
return &Server{
ID: "Custom",
Lat: "?",
Lon: "?",
Country: "?",
URL: host,
URL: parseHost,
Name: u.Host,
Host: u.Host,
Sponsor: "?",
Expand Down
6 changes: 0 additions & 6 deletions speedtest/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,6 @@ func TestCustomServer(t *testing.T) {
if got.Host != "example.com" {
t.Error("did not properly set the Host field on a custom server")
}

// Missing upload.php
_, err = CustomServer("https://example.com")
if err == nil {
t.Error("did not create a custom server without upload.php")
}
}

func TestFetchServerByID(t *testing.T) {
Expand Down
Loading