Skip to content

Commit bf72523

Browse files
committed
fix test
1 parent 074a89e commit bf72523

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

modules/httplib/url_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ func TestIsRelativeURL(t *testing.T) {
4242

4343
func TestGuessCurrentHostURL(t *testing.T) {
4444
defer test.MockVariableValue(&setting.AppURL, "http://cfg-host/sub/")()
45+
defer test.MockVariableValue(&setting.AppSubURL, "/sub")()
46+
defer test.MockVariableValue(&setting.UseHostHeader, false)()
4547

4648
ctx := t.Context()
4749
assert.Equal(t, "http://cfg-host", GuessCurrentHostURL(ctx))

modules/setting/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func loadServerFrom(rootCfg ConfigProvider) {
199199
}
200200

201201
switch protocolCfg {
202-
case "http":
202+
case "", "http":
203203
Protocol = HTTP
204204
case "https":
205205
Protocol = HTTPS

routers/web/admin/admin_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ func TestShadowPassword(t *testing.T) {
7676
func TestSelfCheckPost(t *testing.T) {
7777
defer test.MockVariableValue(&setting.AppURL, "http://config/sub/")()
7878
defer test.MockVariableValue(&setting.AppSubURL, "/sub")()
79+
defer test.MockVariableValue(&setting.UseHostHeader, false)()
7980

8081
ctx, resp := contexttest.MockContext(t, "GET http://host/sub/admin/self_check?location_origin=http://frontend")
8182
SelfCheckPost(ctx)

0 commit comments

Comments
 (0)