0.2.0 #10

Manually merged
xdrm-brackets merged 43 commits from 0.2.0 into master 2020-03-08 15:28:42 +00:00
2 changed files with 39 additions and 0 deletions
Showing only changes of commit 613233faef - Show all commits

View File

@ -57,6 +57,11 @@ func New(uriParams []string, req *http.Request) *Store {
// 1. set URI parameters // 1. set URI parameters
ds.setURIParams(uriParams) ds.setURIParams(uriParams)
// ignore nil requests
if req == nil {
return ds
}
// 2. GET (query) data // 2. GET (query) data
ds.readQuery(req) ds.readQuery(req)

View File

@ -0,0 +1,34 @@
package reqdata
import (
"fmt"
"net/http"
"net/http/httptest"
"testing"
)
func TestEmptyStore(t *testing.T) {
store := New(nil, nil)
if store.URI == nil {
t.Errorf("store 'URI' list should be initialized")
t.Fail()
}
if len(store.URI) != 0 {
t.Errorf("store 'URI' list should be empty")
t.Fail()
}
if store.Get == nil {
t.Errorf("store 'Get' map should be initialized")
t.Fail()
}
if store.Form == nil {
t.Errorf("store 'Form' map should be initialized")
t.Fail()
}
if store.Set == nil {
t.Errorf("store 'Set' map should be initialized")
t.Fail()
}
}