Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
cacfe84c
Commit
cacfe84c
authored
Nov 01, 2018
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused 'body' argument
parent
11c8ab89
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
24 deletions
+19
-24
internal/api/api.go
internal/api/api.go
+19
-24
No files found.
internal/api/api.go
View file @
cacfe84c
...
...
@@ -5,7 +5,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"strconv"
...
...
@@ -170,17 +169,14 @@ func rebaseUrl(url *url.URL, onto *url.URL, suffix string) *url.URL {
return
&
newUrl
}
func
(
api
*
API
)
newRequest
(
r
*
http
.
Request
,
body
io
.
Reader
,
suffix
string
)
(
*
http
.
Request
,
error
)
{
func
(
api
*
API
)
newRequest
(
r
*
http
.
Request
,
suffix
string
)
(
*
http
.
Request
,
error
)
{
authReq
:=
&
http
.
Request
{
Method
:
r
.
Method
,
URL
:
rebaseUrl
(
r
.
URL
,
api
.
URL
,
suffix
),
Header
:
helper
.
HeaderClone
(
r
.
Header
),
}
if
body
!=
nil
{
authReq
.
Body
=
ioutil
.
NopCloser
(
body
)
}
// Clean some headers when issuing a new request without body
if
body
==
nil
{
authReq
.
Header
.
Del
(
"Content-Type"
)
authReq
.
Header
.
Del
(
"Content-Encoding"
)
authReq
.
Header
.
Del
(
"Content-Length"
)
...
...
@@ -197,7 +193,6 @@ func (api *API) newRequest(r *http.Request, body io.Reader, suffix string) (*htt
authReq
.
Header
.
Del
(
"Te"
)
authReq
.
Header
.
Del
(
"Trailers"
)
authReq
.
Header
.
Del
(
"Upgrade"
)
}
// Also forward the Host header, which is excluded from the Header map by the http libary.
// This allows the Host header received by the backend to be consistent with other
...
...
@@ -227,7 +222,7 @@ func (api *API) newRequest(r *http.Request, body io.Reader, suffix string) (*htt
//
// authResponse will only be present if the authorization check was successful
func
(
api
*
API
)
PreAuthorize
(
suffix
string
,
r
*
http
.
Request
)
(
httpResponse
*
http
.
Response
,
authResponse
*
Response
,
outErr
error
)
{
authReq
,
err
:=
api
.
newRequest
(
r
,
nil
,
suffix
)
authReq
,
err
:=
api
.
newRequest
(
r
,
suffix
)
if
err
!=
nil
{
return
nil
,
nil
,
fmt
.
Errorf
(
"preAuthorizeHandler newUpstreamRequest: %v"
,
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment