-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
login: increment 'attempt' while following redirects Apple has introduced some dynamic GET parameters into their redirects, forcing us to use the main domain ( no `p71-` and such prefixes ) to obtain those parameters. However, when following such redirects, we shall also increment the `attempt` parameter (something that was hard-coded before).
- Loading branch information
Showing
5 changed files
with
153 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
package http | ||
|
||
import ( | ||
"errors" | ||
"strings" | ||
) | ||
|
||
var ( | ||
ErrHeaderNotFound = errors.New("header not found") | ||
) | ||
|
||
type Result[R interface{}] struct { | ||
StatusCode int | ||
Headers map[string]string | ||
Data R | ||
} | ||
|
||
func (c *Result[R]) GetHeader(key string) (string, error) { | ||
key = strings.ToLower(key) | ||
for k, v := range c.Headers { | ||
if strings.ToLower(k) == key { | ||
return v, nil | ||
} | ||
} | ||
return "", ErrHeaderNotFound | ||
} |