mirror of
https://github.com/go-kratos/kratos.git
synced 2026-11-23 15:31:42 +08:00
revise err logic or null pointer exception (#2376)
This commit is contained in:
1 parent
f2a33929d0
commit
0ed01efdfd
3 files changed
+4
-10
No files matched your search
@@ -132,9 +132,6 @@ a:
|
||||
t.Fatal(`vvv is not equal to 1`)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(`err is not nil`)
|
||||
}
|
||||
vv, ok = r.Value("a.b.Y")
|
||||
if !ok {
|
||||
t.Fatal(`ok is false`)
|
||||
@@ -147,9 +144,6 @@ a:
|
||||
t.Fatal(`vvy is not equal to "lol"`)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
t.Fatal(`err is not nil`)
|
||||
}
|
||||
vv, ok = r.Value("a.b.z")
|
||||
if !ok {
|
||||
t.Fatal(`ok is false`)
|
||||
|
||||
@@ -26,13 +26,13 @@ var (
|
||||
func makeJSONRequest(uri string, data string, method string, headers map[string]string) ([]byte, error) {
|
||||
client := http.Client{}
|
||||
req, err := http.NewRequest(method, uri, strings.NewReader(data))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.Header.Add("Content-Type", "application/json")
|
||||
for k, v := range headers {
|
||||
req.Header.Add(k, v)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
res, err := client.Do(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -53,7 +53,7 @@ func TestServerTransport(t *testing.T) {
|
||||
t.Errorf("expected:%v got:%v", true, ok)
|
||||
}
|
||||
if mtr == nil {
|
||||
t.Errorf("expected:%v got:%v", nil, mtr)
|
||||
t.Fatalf("expected:%v got:%v", nil, mtr)
|
||||
}
|
||||
if mtr.Kind().String() != KindGRPC.String() {
|
||||
t.Errorf("expected:%v got:%v", KindGRPC.String(), mtr.Kind().String())
|
||||
|
||||
Reference in new issue
Block a user