<commit_before>package luddite

import (
	"net/http"
	"net/url"
	"strconv"
)

const (
	HeaderAccept               = "Accept"
	HeaderAuthorization        = "Authorization"
	HeaderContentType          = "Content-Type"
	HeaderContentDisposition   = "Content-Disposition"
	HeaderETag                 = "ETag"
	HeaderForwardedFor         = "X-Forwarded-For"
	HeaderIfNoneMatch          = "If-None-Match"
	HeaderLocation             = "Location"
	HeaderRequestId            = "X-Request-Id"
	HeaderSpirentApiVersion    = "X-Spirent-Api-Version"
	HeaderSpirentInhibitPaging = "X-Spirent-Inhibit-Paging"
	HeaderSpirentMetaPrefix    = "X-Spirent-Meta-"
	HeaderSpirentNextLink      = "X-Spirent-Next-Link"
	HeaderSpirentResourceNonce = "X-Spirent-Resource-Nonce"

	CursorNever = "never"
)

func RequestId(r *http.Request) string {
	return r.Header.Get(HeaderRequestId)
}

func RequestBearerToken(r *http.Request) (token string) {
	if authStr := r.Header.Get(HeaderAuthorization); len(authStr) >= 7 && authStr[:7] == "Bearer " {
		token = authStr[7:]
	}<commit_msg>Access access tokens from URL query string parameters (when not otherwise provided by HTTP request headers).<commit_after>package luddite

import (
	"net/http"
	"net/url"
	"strconv"
)

const (
	HeaderAccept               = "Accept"
	HeaderAuthorization        = "Authorization"
	HeaderContentType          = "Content-Type"
	HeaderContentDisposition   = "Content-Disposition"
	HeaderETag                 = "ETag"
	HeaderForwardedFor         = "X-Forwarded-For"
	HeaderIfNoneMatch          = "If-None-Match"
	HeaderLocation             = "Location"
	HeaderRequestId            = "X-Request-Id"
	HeaderSpirentApiVersion    = "X-Spirent-Api-Version"
	HeaderSpirentInhibitPaging = "X-Spirent-Inhibit-Paging"
	HeaderSpirentMetaPrefix    = "X-Spirent-Meta-"
	HeaderSpirentNextLink      = "X-Spirent-Next-Link"
	HeaderSpirentResourceNonce = "X-Spirent-Resource-Nonce"

	CursorNever = "never"
)

func RequestId(r *http.Request) string {
	return r.Header.Get(HeaderRequestId)
}

func RequestBearerToken(r *http.Request) (token string) {
	if authStr := r.Header.Get(HeaderAuthorization); len(authStr) >= 7 && authStr[:7] == "Bearer " {
		token = authStr[7:]
	} else {
		token = r.URL.Query().Get("access_token")
	}
{'fraction_non_alphanumeric': 0.11829862649534781, 'fraction_numerical': 0.002658396101019052, 'mean_word_length': 3.367504835589942, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1000683', 'n_tokens_mistral': 782, 'n_tokens_neox': 767, 'n_words': 132}