mirror of
https://github.com/thewhitetulip/Tasks.git
synced 2025-04-26 13:49:18 +08:00
Form is just a map[string][]string. It is easy to manipulate. But url.ParseQuery can also be used.
This commit is contained in:
parent
38d7058e79
commit
6d40ebfceb
@ -5,7 +5,6 @@ import (
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
@ -40,7 +39,9 @@ func TestAddEmptyCategory(t *testing.T) {
|
||||
ts := httptest.NewServer(http.HandlerFunc(AddCategoryFunc))
|
||||
defer ts.Close()
|
||||
req, err := http.NewRequest("POST", ts.URL, nil)
|
||||
req.Form, _ = url.ParseQuery("category=")
|
||||
req.Form = make(map[string][]string, 0)
|
||||
req.Form.Add("category", "")
|
||||
// req.Form, _ = url.ParseQuery("category=")
|
||||
if err != nil {
|
||||
t.Errorf("Error occured while constracting request:%s", err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user