mirror of
https://github.com/chainreactors/spray.git
synced 2025-09-15 11:40:13 +00:00
fix NewBaseline panic
This commit is contained in:
parent
a965412c1a
commit
b84535a06b
@ -50,7 +50,12 @@ func NewBaseline(u, host string, resp *ihttp.Response) *Baseline {
|
||||
|
||||
bl.Raw = append(bl.Header, bl.Body...)
|
||||
bl.Response, err = ParseRawResponse(bl.Raw)
|
||||
|
||||
if err != nil {
|
||||
bl.IsValid = false
|
||||
bl.Reason = ErrResponseError.Error()
|
||||
bl.ErrString = err.Error()
|
||||
return bl
|
||||
}
|
||||
if r := bl.Response.Header.Get("Location"); r != "" {
|
||||
bl.RedirectURL = r
|
||||
} else {
|
||||
|
@ -16,6 +16,7 @@ const (
|
||||
ErrFuzzyRedirect
|
||||
ErrFuzzyNotUnique
|
||||
ErrUrlError
|
||||
ErrResponseError
|
||||
)
|
||||
|
||||
var ErrMap = map[ErrorType]string{
|
||||
@ -32,6 +33,7 @@ var ErrMap = map[ErrorType]string{
|
||||
ErrFuzzyRedirect: "fuzzy redirect",
|
||||
ErrFuzzyNotUnique: "not unique",
|
||||
ErrUrlError: "url parse error",
|
||||
ErrResponseError: "response parse error",
|
||||
}
|
||||
|
||||
func (e ErrorType) Error() string {
|
||||
|
Loading…
x
Reference in New Issue
Block a user