mirror of
https://github.com/Xevion/scla-unsubscribe.git
synced 2025-12-06 13:16:22 -06:00
Remove Keep-Alive headers from ApplyHeader helpers
This commit is contained in:
@@ -9,9 +9,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DoRequestNoRead makes a request and returns the response
|
// DoRequestNoRead makes a request and returns the response
|
||||||
// Compared to DoRequest, this function does not read the response body
|
// Compared to DoRequest, this function does not read the response body, and it uses the Content-Length header for the associated log attribute.
|
||||||
// This function encapsulates the boilerplate for logging
|
// This function encapsulates the boilerplate for logging.
|
||||||
func DoRequestNoRead(req *http.Request) (*http.Response, error) {
|
func DoRequestNoRead(req *http.Request) (*http.Response, error) {
|
||||||
|
// Log the request
|
||||||
log.Debug().Str("method", req.Method).Str("host", req.Host).Str("path", req.URL.Path).Msg("Request")
|
log.Debug().Str("method", req.Method).Str("host", req.Host).Str("path", req.URL.Path).Msg("Request")
|
||||||
|
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
@@ -64,7 +65,6 @@ func DoRequest(req *http.Request) (*http.Response, []byte, error) {
|
|||||||
// ApplySclaHeaders applies headers to a request for thescla.org
|
// ApplySclaHeaders applies headers to a request for thescla.org
|
||||||
func ApplySclaHeaders(req *http.Request) {
|
func ApplySclaHeaders(req *http.Request) {
|
||||||
req.Header.Set("Origin", "http://www2.thescla.org")
|
req.Header.Set("Origin", "http://www2.thescla.org")
|
||||||
req.Header.Set("Connection", "keep-alive")
|
|
||||||
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0")
|
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0")
|
||||||
req.Header.Set("Accept", "application/json, text/javascript, */*; q=0.01")
|
req.Header.Set("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||||
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
||||||
@@ -73,7 +73,6 @@ func ApplySclaHeaders(req *http.Request) {
|
|||||||
|
|
||||||
// ApplyUtsaHeaders applies headers to a request for utsa.edu
|
// ApplyUtsaHeaders applies headers to a request for utsa.edu
|
||||||
func ApplyUtsaHeaders(req *http.Request) {
|
func ApplyUtsaHeaders(req *http.Request) {
|
||||||
req.Header.Set("Connection", "keep-alive")
|
|
||||||
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0")
|
req.Header.Set("User-Agent", "Mozilla/5.0 (X11; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0")
|
||||||
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
|
req.Header.Set("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8")
|
||||||
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
||||||
|
|||||||
Reference in New Issue
Block a user