Commit cf47d4b1 authored by Martin Sefcik's avatar Martin Sefcik

Reverted back Go 1.5 related code

parent 8ab3d8fc
language: go
go:
- 1.5
- 1.4
......@@ -3,9 +3,7 @@
A GitLab API client enabling Go programs to interact with GitLab in a simple and uniform way
**Documentation:** [![GoDoc](https://godoc.org/github.com/xanzy/go-gitlab?status.svg)](https://godoc.org/github.com/xanzy/go-gitlab)
**Build Status:** [![Build Status](https://travis-ci.org/xanzy/go-gitlab.svg?branch=master)](https://travis-ci.org/xanzy/go-gitlab)
go-gitlab requires Go version 1.5 or greater.
**Build Status:** [![Build Status](https://travis-ci.org/xanzy/go-gitlab.svg?branch=master)](https://travis-ci.org/xanzy/go-gitlab)
## Coverage
......
......@@ -196,10 +196,9 @@ func (c *Client) SetBaseURL(urlStr string) error {
// specified, the value pointed to by body is JSON encoded and included as the
// request body.
func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request, error) {
u, err := url.Parse(c.baseURL.String() + path)
if err != nil {
return nil, err
}
u := *c.baseURL
// Set the encoded opaque data
u.Opaque = c.baseURL.Path + path
q, err := query.Values(opt)
if err != nil {
......@@ -209,7 +208,7 @@ func (c *Client) NewRequest(method, path string, opt interface{}) (*http.Request
req := &http.Request{
Method: method,
URL: u,
URL: &u,
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
......@@ -350,9 +349,11 @@ type ErrorResponse struct {
}
func (r *ErrorResponse) Error() string {
path, _ := url.QueryUnescape(r.Response.Request.URL.Opaque)
ru := fmt.Sprintf("%s://%s%s", r.Response.Request.URL.Scheme, r.Response.Request.URL.Host, path)
return fmt.Sprintf("%v %s: %d %v %+v",
r.Response.Request.Method, r.Response.Request.URL.String(),
r.Response.StatusCode, r.Message, r.Errors)
r.Response.Request.Method, ru, r.Response.StatusCode, r.Message, r.Errors)
}
// An Error reports more details on an individual error in an ErrorResponse.
......
......@@ -33,8 +33,8 @@ func teardown(server *httptest.Server) {
}
func testUrl(t *testing.T, r *http.Request, want string) {
if got := r.URL.String(); got != want {
t.Errorf("Request url: %s, want %s", got, want)
if got := r.RequestURI; got != want {
t.Errorf("Request url: %+v, want %s", got, want)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment