mirror of
https://github.com/minio/minio.git
synced 2025-11-07 21:02:58 -05:00
feat: Deprecate embedded browser and import console (#12460)
This feature also changes the default port where the browser is running, now the port has moved to 9001 and it can be configured with ``` --console-address ":9001" ```
This commit is contained in:
@@ -28,63 +28,6 @@ import (
|
||||
xhttp "github.com/minio/minio/internal/http"
|
||||
)
|
||||
|
||||
// Tests getRedirectLocation function for all its criteria.
|
||||
func TestRedirectLocation(t *testing.T) {
|
||||
testCases := []struct {
|
||||
urlPath string
|
||||
location string
|
||||
}{
|
||||
{
|
||||
// 1. When urlPath is '/minio'
|
||||
urlPath: minioReservedBucketPath,
|
||||
location: minioReservedBucketPath + SlashSeparator,
|
||||
},
|
||||
{
|
||||
// 2. When urlPath is '/'
|
||||
urlPath: SlashSeparator,
|
||||
location: minioReservedBucketPath + SlashSeparator,
|
||||
},
|
||||
{
|
||||
// 3. When urlPath is '/webrpc'
|
||||
urlPath: "/webrpc",
|
||||
location: minioReservedBucketPath + "/webrpc",
|
||||
},
|
||||
{
|
||||
// 4. When urlPath is '/login'
|
||||
urlPath: "/login",
|
||||
location: minioReservedBucketPath + "/login",
|
||||
},
|
||||
{
|
||||
// 5. When urlPath is '/favicon-16x16.png'
|
||||
urlPath: "/favicon-16x16.png",
|
||||
location: minioReservedBucketPath + "/favicon-16x16.png",
|
||||
},
|
||||
{
|
||||
// 6. When urlPath is '/favicon-16x16.png'
|
||||
urlPath: "/favicon-32x32.png",
|
||||
location: minioReservedBucketPath + "/favicon-32x32.png",
|
||||
},
|
||||
{
|
||||
// 7. When urlPath is '/favicon-96x96.png'
|
||||
urlPath: "/favicon-96x96.png",
|
||||
location: minioReservedBucketPath + "/favicon-96x96.png",
|
||||
},
|
||||
{
|
||||
// 8. When urlPath is '/unknown'
|
||||
urlPath: "/unknown",
|
||||
location: "",
|
||||
},
|
||||
}
|
||||
|
||||
// Validate all conditions.
|
||||
for i, testCase := range testCases {
|
||||
loc := getRedirectLocation(testCase.urlPath)
|
||||
if testCase.location != loc {
|
||||
t.Errorf("Test %d: Unexpected location expected %s, got %s", i+1, testCase.location, loc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Tests request guess function for net/rpc requests.
|
||||
func TestGuessIsRPC(t *testing.T) {
|
||||
if guessIsRPCReq(nil) {
|
||||
@@ -113,34 +56,6 @@ func TestGuessIsRPC(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Tests browser request guess function.
|
||||
func TestGuessIsBrowser(t *testing.T) {
|
||||
globalBrowserEnabled = true
|
||||
if guessIsBrowserReq(nil) {
|
||||
t.Fatal("Unexpected return for nil request")
|
||||
}
|
||||
r := &http.Request{
|
||||
Header: http.Header{},
|
||||
URL: &url.URL{},
|
||||
}
|
||||
r.Header.Set("User-Agent", "Mozilla")
|
||||
if !guessIsBrowserReq(r) {
|
||||
t.Fatal("Test shouldn't fail for a possible browser request anonymous user")
|
||||
}
|
||||
r.Header.Set("Authorization", "Bearer token")
|
||||
if !guessIsBrowserReq(r) {
|
||||
t.Fatal("Test shouldn't fail for a possible browser request JWT user")
|
||||
}
|
||||
r = &http.Request{
|
||||
Header: http.Header{},
|
||||
URL: &url.URL{},
|
||||
}
|
||||
r.Header.Set("User-Agent", "mc")
|
||||
if guessIsBrowserReq(r) {
|
||||
t.Fatal("Test shouldn't report as browser for a non browser request.")
|
||||
}
|
||||
}
|
||||
|
||||
var isHTTPHeaderSizeTooLargeTests = []struct {
|
||||
header http.Header
|
||||
shouldFail bool
|
||||
|
||||
Reference in New Issue
Block a user