Repository: go-resty/resty (go)

Issue:
SetResult fails to parse JSON when the returned Content-Type is "application/x-amz-json-1.1" 
I found the SetResult API fails to parse the result JSON if the `Content-Type` is equal to "application/x-amz-json-1.1" (which Amazon uses for some endpoints).  Would it be possible to add this as a supported Content-Type, or possibly support setting a custom JSON Content-Type for resty?

Looks like this is the regex that is failing to match:  https://github.com/go-resty/resty/blob/master/client.go#L63



Pull request:
fix: improve regex expression for json and xml content type validation
Closes #594

Patch:
diff --git a/client.go b/client.go
index 751e7b5..321a60f 100644
--- a/client.go
+++ b/client.go
@@ -62,8 +62,8 @@ var (
 	jsonContentType = "application/json"
 	formContentType = "application/x-www-form-urlencoded"
 
-	jsonCheck = regexp.MustCompile(`(?i:(application|text)/(json|.*\+json|json\-.*)(;|$))`)
-	xmlCheck  = regexp.MustCompile(`(?i:(application|text)/(xml|.*\+xml)(;|$))`)
+	jsonCheck = regexp.MustCompile(`(?i:(application|text)/(.*json.*)(;|$))`)
+	xmlCheck  = regexp.MustCompile(`(?i:(application|text)/(.*xml.*)(;|$))`)
 
 	hdrUserAgentValue = "go-resty/" + Version + " (https://github.com/go-resty/resty)"
 	bufPool           = &sync.Pool{New: func() interface{} { return &bytes.Buffer{} }}


Test patch:
diff --git a/util_test.go b/util_test.go
index a78babf..74cf4b1 100644
--- a/util_test.go
+++ b/util_test.go
@@ -23,20 +23,18 @@ func TestIsJSONType(t *testing.T) {
 		{"application/vnd.foo+json; charset=utf-8", true},
 
 		{"text/json", true},
-		{"text/xml+json", true},
 		{"text/vnd.foo+json", true},
 
-		{"application/foo-json", false},
-		{"application/foo.json", false},
-		{"application/vnd.foo-json", false},
-		{"application/vnd.foo.json", false},
-		{"application/json+xml", false},
-
-		{"text/foo-json", false},
-		{"text/foo.json", false},
-		{"text/vnd.foo-json", false},
-		{"text/vnd.foo.json", false},
-		{"text/json+xml", false},
+		{"application/foo-json", true},
+		{"application/foo.json", true},
+		{"application/vnd.foo-json", true},
+		{"application/vnd.foo.json", true},
+		{"application/x-amz-json-1.1", true},
+
+		{"text/foo-json", true},
+		{"text/foo.json", true},
+		{"text/vnd.foo-json", true},
+		{"text/vnd.foo.json", true},
 	} {
 		result := IsJSONType(test.input)
 
@@ -52,27 +50,23 @@ func TestIsXMLType(t *testing.T) {
 		expect bool
 	}{
 		{"application/xml", true},
-		{"application/json+xml", true},
 		{"application/vnd.foo+xml", true},
 
 		{"application/xml; charset=utf-8", true},
 		{"application/vnd.foo+xml; charset=utf-8", true},
 
 		{"text/xml", true},
-		{"text/json+xml", true},
 		{"text/vnd.foo+xml", true},
 
-		{"application/foo-xml", false},
-		{"application/foo.xml", false},
-		{"application/vnd.foo-xml", false},
-		{"application/vnd.foo.xml", false},
-		{"application/xml+json", false},
-
-		{"text/foo-xml", false},
-		{"text/foo.xml", false},
-		{"text/vnd.foo-xml", false},
-		{"text/vnd.foo.xml", false},
-		{"text/xml+json", false},
+		{"application/foo-xml", true},
+		{"application/foo.xml", true},
+		{"application/vnd.foo-xml", true},
+		{"application/vnd.foo.xml", true},
+
+		{"text/foo-xml", true},
+		{"text/foo.xml", true},
+		{"text/vnd.foo-xml", true},
+		{"text/vnd.foo.xml", true},
 	} {
 		result := IsXMLType(test.input)