Checking ifModifiedSince param

This commit is contained in:
Deluan
2016-03-01 16:05:49 -05:00
parent 841d8f457f
commit b8948c417e
5 changed files with 88 additions and 22 deletions
+7 -2
View File
@@ -6,6 +6,7 @@ import (
"net/http"
"net/http/httptest"
_ "github.com/deluan/gosonic/conf"
"strings"
)
const (
@@ -15,8 +16,12 @@ const (
testVersion = "1.0.0"
)
func AddParams(url string) string {
return fmt.Sprintf("%s?u=%s&p=%s&c=%s&v=%s", url, testUser, testPassword, testClient, testVersion)
func AddParams(endpoint string, params ...string) string {
url := fmt.Sprintf("%s?u=%s&p=%s&c=%s&v=%s", endpoint, testUser, testPassword, testClient, testVersion)
if len(params) > 0 {
url = url + "&" + strings.Join(params, "&")
}
return url
}
func Get(url string, testCase string) (*http.Request, *httptest.ResponseRecorder) {