fix: satisfy staticcheck in integrations
This commit is contained in:
@@ -548,9 +548,7 @@ func metricsEndpoint(urlStr string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
prefix := "https://api.jikan.moe/v4"
|
prefix := "https://api.jikan.moe/v4"
|
||||||
if strings.HasPrefix(trimmed, prefix) {
|
trimmed = strings.TrimPrefix(trimmed, prefix)
|
||||||
trimmed = strings.TrimPrefix(trimmed, prefix)
|
|
||||||
}
|
|
||||||
|
|
||||||
if idx := strings.Index(trimmed, "?"); idx >= 0 {
|
if idx := strings.Index(trimmed, "?"); idx >= 0 {
|
||||||
trimmed = trimmed[:idx]
|
trimmed = trimmed[:idx]
|
||||||
|
|||||||
@@ -138,19 +138,19 @@ Jujutsu Kaisen 0
|
|||||||
Dec 24, 2021 | Movie | 1ep × 1hr. 44min. | ★8.36 | [](https://myanimelist.net/anime/48561)
|
Dec 24, 2021 | Movie | 1ep × 1hr. 44min. | ★8.36 | [](https://myanimelist.net/anime/48561)
|
||||||
`
|
`
|
||||||
|
|
||||||
testClient := &http.Client{
|
testClient := &http.Client{
|
||||||
Timeout: time.Second,
|
Timeout: time.Second,
|
||||||
Transport: roundTripFunc(func(request *http.Request) (*http.Response, error) {
|
Transport: roundTripFunc(func(request *http.Request) (*http.Response, error) {
|
||||||
switch {
|
switch request.URL.Host {
|
||||||
case request.URL.Host == "chiaki.site":
|
case "chiaki.site":
|
||||||
return mockResponse(http.StatusForbidden, map[string]string{"Content-Type": "text/html; charset=utf-8"}, "blocked"), nil
|
return mockResponse(http.StatusForbidden, map[string]string{"Content-Type": "text/html; charset=utf-8"}, "blocked"), nil
|
||||||
case request.URL.Host == "r.jina.ai":
|
case "r.jina.ai":
|
||||||
// Proxy response is plain text/markdown.
|
// Proxy response is plain text/markdown.
|
||||||
return mockResponse(http.StatusOK, map[string]string{"Content-Type": "text/plain; charset=utf-8"}, proxyPayload), nil
|
return mockResponse(http.StatusOK, map[string]string{"Content-Type": "text/plain; charset=utf-8"}, proxyPayload), nil
|
||||||
default:
|
default:
|
||||||
return mockResponse(http.StatusNotFound, nil, "not found"), nil
|
return mockResponse(http.StatusNotFound, nil, "not found"), nil
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
result, err := FetchWatchOrder(context.Background(), testClient, "https://chiaki.site/?/tools/watch_order/id/40748")
|
result, err := FetchWatchOrder(context.Background(), testClient, "https://chiaki.site/?/tools/watch_order/id/40748")
|
||||||
|
|||||||
Reference in New Issue
Block a user