Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
bahn-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Janne Mareike Koschinski
bahn-api
Commits
f1eab971
Commit
f1eab971
authored
6 years ago
by
Janne Mareike Koschinski
Browse files
Options
Downloads
Patches
Plain Diff
Fixed suggestions parsing
parent
86c6ad87
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
client.go
+11
-1
11 additions, 1 deletion
client.go
with
11 additions
and
1 deletion
client.go
+
11
−
1
View file @
f1eab971
...
@@ -2,7 +2,9 @@ package bahn
...
@@ -2,7 +2,9 @@ package bahn
import
(
import
(
"fmt"
"fmt"
"io/ioutil"
"net/http"
"net/http"
"strings"
"time"
"time"
"net/url"
"net/url"
...
@@ -174,7 +176,15 @@ func (c *ApiClient) Suggestions(line string, date time.Time) ([]Suggestion, erro
...
@@ -174,7 +176,15 @@ func (c *ApiClient) Suggestions(line string, date time.Time) ([]Suggestion, erro
return
suggestions
,
err
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
return
suggestions
,
err
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment