Update dependencies

This commit is contained in:
James
2017-08-16 11:15:14 -07:00
parent b9c0374fe3
commit f46ea14760
1220 changed files with 142690 additions and 47576 deletions

View File

@@ -0,0 +1,9 @@
// +build go1.8
package middleware
import "net/url"
func pathUnescape(path string) (string, error) {
return url.PathUnescape(path)
}

View File

@@ -0,0 +1,9 @@
// +build !go1.8
package middleware
import "net/url"
func pathUnescape(path string) (string, error) {
return url.QueryUnescape(path)
}

View File

@@ -16,7 +16,6 @@ package middleware
import (
"net/http"
"net/url"
fpath "path"
"regexp"
"strings"
@@ -182,7 +181,7 @@ func (d *defaultRouter) Lookup(method, path string) (*MatchedRoute, bool) {
debugLog("found a route for %s %s with %d parameters", method, path, len(entry.Parameters))
var params RouteParams
for _, p := range rp {
v, err := url.PathUnescape(p.Value)
v, err := pathUnescape(p.Value)
if err != nil {
debugLog("failed to escape %q: %v", p.Value, err)
v = p.Value

View File

@@ -41,6 +41,7 @@ func TestContentTypeValidation(t *testing.T) {
recorder = httptest.NewRecorder()
request, _ = http.NewRequest("POST", "/api/pets", nil)
request.Header.Add("content-type", "application(")
request.Header.Add("Accept", "application/json")
request.ContentLength = 1
mw.ServeHTTP(recorder, request)