fix(torznab): Jackett support (#388)

* feat(torznab): add Jackett support

* Update torznab.go

* fix(feeds): unify jackett and prowlarr apikey
This commit is contained in:
Kyle Sanderson 2022-08-01 06:21:29 -07:00 committed by GitHub
parent a9fe2cf500
commit eefd1b576c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 8 deletions

View file

@ -5,6 +5,7 @@ import (
"io/ioutil"
"net/http"
"net/http/httptest"
"strings"
"testing"
"github.com/stretchr/testify/assert"
@ -71,8 +72,14 @@ func TestClient_GetCaps(t *testing.T) {
key := "mock-key"
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
apiKey := r.Header.Get("X-API-Key")
if apiKey != key {
//apiKey := r.Header.Get("X-API-Key")
//if apiKey != key {
// w.WriteHeader(http.StatusUnauthorized)
// w.Write(nil)
// return
//}
if !strings.Contains(r.RequestURI, key) {
w.WriteHeader(http.StatusUnauthorized)
w.Write(nil)
return