Files
kapow/internal/http/reason.go
Roberto Abdelkader Martínez Pérez 80eea3c886 Documentation and better naming
2019-10-03 14:17:24 +02:00

16 lines
259 B
Go

package http
import (
"net/http"
"strings"
)
// GetReason returns the reason phrase part of an HTTP response
func GetReason(r *http.Response) string {
if i := strings.IndexByte(r.Status, ' '); i != -1 {
return r.Status[i+1:]
} else {
return ""
}
}