diff --git a/client.go b/client.go index 62c865d6177b454147727b973a5efaac47968278..308f7763ad23a338741abd5b83af063c0f968d95 100644 --- a/client.go +++ b/client.go @@ -2,7 +2,9 @@ package bahn import ( "fmt" + "io/ioutil" "net/http" + "strings" "time" "net/url" @@ -174,7 +176,15 @@ func (c *ApiClient) Suggestions(line string, date time.Time) ([]Suggestion, erro return suggestions, err } - if suggestions, err = SuggestionsFromReader(response.Body); err != nil { + var content []byte + if content, err = ioutil.ReadAll(response.Body); err != nil { + return suggestions, err + } + strippedContent := string(content) + strippedContent = strings.TrimPrefix(strippedContent, "TSLs.sls = ") + strippedContent = strings.TrimSuffix(strippedContent, ";") + + if suggestions, err = SuggestionsFromBytes([]byte(strippedContent)); err != nil { return suggestions, err }