Skip to content

Commit

Permalink
chore: fix ci test error in gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Jun 14, 2022
1 parent ad16845 commit 00cd51d
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions router_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import (
"encoding/base64"
"fmt"
"net/http"
"runtime"
"strings"
"testing"

"github.com/gookit/goutil/envutil"
"github.com/gookit/goutil/netutil/httpctype"
"github.com/gookit/goutil/testutil"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -699,27 +697,30 @@ func TestRouter_WithOptions(t *testing.T) {
func TestAccessStaticAssets(t *testing.T) {
r := New()
is := assert.New(t)
gov := runtime.Version()[2:]
// gov := runtime.Version()[2:]

checkJsAssetHeader := func(contentType string) {
if envutil.IsWin() {
// go > 1.17: "application/javascript"
if gov >= "1.17" {
is.Equal("application/javascript", contentType)
} else {
is.Equal("text/plain; charset=utf-8", contentType)
}
} else {
is.Contains(contentType, "javascript")

// go < 1.17: "application/javascript"
// go >= 1.17: text/javascript; charset=utf-8
if gov >= "1.17" {
is.Equal("application/javascript", contentType)
} else {
is.Equal("text/javascript; charset=utf-8", contentType)
}
}
// new go version has been fixed
is.Equal("application/javascript", contentType)

// if envutil.IsWin() {
// // go > 1.17: "application/javascript"
// if gov >= "1.17" {
// is.Equal("application/javascript", contentType)
// } else {
// is.Equal("text/plain; charset=utf-8", contentType)
// }
// } else {
// is.Contains(contentType, "javascript")
//
// // go < 1.17: "application/javascript"
// // go >= 1.17: text/javascript; charset=utf-8
// if gov >= "1.17" {
// is.Equal("application/javascript", contentType)
// } else {
// is.Equal("text/javascript; charset=utf-8", contentType)
// }
// }
}

// one file
Expand Down

0 comments on commit 00cd51d

Please sign in to comment.