Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cashier
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
Kevin Lyda
cashier
Commits
5a57870d
Commit
5a57870d
authored
9 years ago
by
Niall Sheridan
Browse files
Options
Downloads
Patches
Plain Diff
Check the error before trying to read the response.
parent
5e951c17
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/main.go
+3
-3
3 additions, 3 deletions
client/main.go
with
3 additions
and
3 deletions
client/main.go
+
3
−
3
View file @
5a57870d
...
...
@@ -46,12 +46,12 @@ func send(s []byte, token string) (*lib.SignResponse, error) {
req
.
Header
.
Set
(
"Authorization"
,
fmt
.
Sprintf
(
"Bearer %s"
,
token
))
client
:=
&
http
.
Client
{}
resp
,
err
:=
client
.
Do
(
req
)
if
resp
.
StatusCode
!=
http
.
StatusOK
{
return
nil
,
fmt
.
Errorf
(
"Bad response from server: %s"
,
resp
.
Status
)
}
if
err
!=
nil
{
return
nil
,
err
}
if
resp
.
StatusCode
!=
http
.
StatusOK
{
return
nil
,
fmt
.
Errorf
(
"Bad response from server: %s"
,
resp
.
Status
)
}
defer
resp
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
resp
.
Body
)
if
err
!=
nil
{
...
...
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