Fix logic for Accept and Content-Type headers

このコミットが含まれているのは:
Cory Slep 2018-06-03 01:29:47 +02:00
コミット 62ec7d5278
1個のファイルの変更2行の追加2行の削除

ファイルの表示

@ -58,11 +58,11 @@ func headerEqualsOneOf(header string, acceptable []string) bool {
}
func isActivityPubPost(r *http.Request) bool {
return r.Method == "POST" && headerEqualsOneOf(r.Header.Get(contentTypeHeader), []string{postContentTypeHeader, contentTypeHeader})
return r.Method == "POST" && headerEqualsOneOf(r.Header.Get(contentTypeHeader), append([]string{postContentTypeHeader}, alternatives...))
}
func isActivityPubGet(r *http.Request) bool {
return r.Method == "GET" && headerEqualsOneOf(r.Header.Get(acceptHeader), []string{getAcceptHeader, contentTypeHeader})
return r.Method == "GET" && headerEqualsOneOf(r.Header.Get(acceptHeader), append([]string{getAcceptHeader}, alternatives...))
}
// isPublic determines if a target is the Public collection as defined in the