integration: Don't send Link header field for resource under /css/

This commit is contained in:
Tatsuhiro Tsujikawa 2015-04-08 16:09:02 +09:00
parent 80743ddc7b
commit ff60cc6b71
1 changed files with 4 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import (
"io" "io"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"strings"
"syscall" "syscall"
"testing" "testing"
) )
@ -494,7 +495,9 @@ func TestH2H1SNI(t *testing.T) {
func TestH2H1ServerPush(t *testing.T) { func TestH2H1ServerPush(t *testing.T) {
st := newServerTester(nil, t, func(w http.ResponseWriter, r *http.Request) { st := newServerTester(nil, t, func(w http.ResponseWriter, r *http.Request) {
// only resources marked as rel=preload are pushed // only resources marked as rel=preload are pushed
if !strings.HasPrefix(r.URL.Path, "/css/") {
w.Header().Add("Link", "</css/main.css>; rel=preload, </foo>, </css/theme.css>; rel=preload") w.Header().Add("Link", "</css/main.css>; rel=preload, </foo>, </css/theme.css>; rel=preload")
}
}) })
defer st.Close() defer st.Close()