mirror of
https://github.com/Xevion/scla-unsubscribe.git
synced 2025-12-06 01:16:15 -06:00
Separate SCLA/UTSA ApplyHeaders helper methods
This commit is contained in:
10
helpers.go
10
helpers.go
@@ -42,7 +42,7 @@ func DoRequest(req *http.Request) (*http.Response, []byte, error) {
|
||||
return resp, body, nil
|
||||
}
|
||||
|
||||
func ApplyHeaders(req *http.Request) {
|
||||
func ApplySclaHeaders(req *http.Request) {
|
||||
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")
|
||||
@@ -50,3 +50,11 @@ func ApplyHeaders(req *http.Request) {
|
||||
req.Header.Set("Accept-Language", "en-US,en;q=0.5")
|
||||
req.Header.Set("Accept-Encoding", "gzip, deflate")
|
||||
}
|
||||
|
||||
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("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-Encoding", "gzip, deflate")
|
||||
}
|
||||
|
||||
2
unsub.go
2
unsub.go
@@ -64,7 +64,7 @@ func Unsubscribe(email string) (*ConfirmationResponse, error) {
|
||||
request.Header.Set("Referer", "http://www2.thescla.org/UnsubscribePage.html?mkt_unsubscribe=1")
|
||||
request.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||
request.Header.Set("X-Requested-With", "XMLHttpRequest")
|
||||
ApplyHeaders(request)
|
||||
ApplySclaHeaders(request)
|
||||
|
||||
// Send request
|
||||
response, body, err := DoRequest(request)
|
||||
|
||||
Reference in New Issue
Block a user