Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Assignment 1
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Aksel Baardsen
Assignment 1
Commits
0b9066f3
Commit
0b9066f3
authored
5 years ago
by
Aksel Baardsen
Browse files
Options
Downloads
Patches
Plain Diff
added global http client
parent
c0cb5b6a
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
pkg/funcs.go
+5
-5
5 additions, 5 deletions
pkg/funcs.go
with
5 additions
and
5 deletions
pkg/funcs.go
+
5
−
5
View file @
0b9066f3
...
...
@@ -8,6 +8,11 @@ import (
"time"
)
// creates http client for ensuring timely timeouts
var
client
=
http
.
Client
{
Timeout
:
5
*
time
.
Second
,
}
// allowing access to "overloaded" functions
func
unfold
(
m
mashup
,
response
*
http
.
Response
)
error
{
return
m
.
unmarshal
(
response
)
...
...
@@ -39,11 +44,6 @@ func (s *Specie) unmarshal(resp *http.Response) error {
// parses http.response as a string used later for parsing
func
getBody
(
url
string
,
m
mashup
)
error
{
// creates a client to allow for timeout
client
:=
http
.
Client
{
Timeout
:
4
*
time
.
Second
,
}
// sends a http request
resp
,
err
:=
client
.
Get
(
url
)
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