24 lines
724 B
Go
24 lines
724 B
Go
package ap
|
|
|
|
import "strings"
|
|
|
|
// Header used for making requests for AP resources
|
|
// Not used yet
|
|
const OUTBOUND_REQUEST_HEADER = "application/ld+json, application/json;q=0.9, application/javascript;q=0.5, text/javascript;q=0.5, text/plain;q=0.2, */*;q=0.1"
|
|
|
|
var contentHeadersToCheck = []string{
|
|
"application/json",
|
|
"application/ld+json",
|
|
}
|
|
|
|
// Check a given string if it contains any of the content types specified in
|
|
// the contentHeadersToCheck slice
|
|
// Used for differentiating requests for the ActivityPub version of some data vs frontend version
|
|
func ContainsApContentHeader(toCheck string) bool {
|
|
for _, h := range contentHeadersToCheck {
|
|
if strings.Contains(toCheck, h) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|