forked from web-platform-tests/wpt.fyi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
interop_handler.go
38 lines (31 loc) · 993 Bytes
/
interop_handler.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2017 The WPT Dashboard Project. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package webapp
import (
"net/http"
"github.com/web-platform-tests/wpt.fyi/shared"
)
// interopHandler handles the view of test results broken down by the
// number of browsers for which the test passes.
func interopHandler(w http.ResponseWriter, r *http.Request) {
testRunFilter, err := shared.ParseTestRunFilterParams(r.URL.Query())
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
testRunFilter = testRunFilter.OrDefault()
uiFilters := convertTestRunUIFilter(testRunFilter)
data := struct {
Metadata string
Filter testRunUIFilter
Query string
}{
Filter: uiFilters,
Query: r.URL.Query().Get("q"),
}
if err := templates.ExecuteTemplate(w, "interoperability.html", data); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
}