Skip to content

Commit

Permalink
Fix test helper panic when controller does not write media type (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Simon authored Aug 9, 2016
1 parent 2a6e833 commit 72202fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion design/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,7 @@ func (u *UserTypeDefinition) ToHash() *Hash { return u.Type.ToHash() }
// CanHaveDefault calls CanHaveDefault on the user type underlying data type.
func (u *UserTypeDefinition) CanHaveDefault() bool { return u.Type.CanHaveDefault() }

// IsCompatible returns true if val is compatible with p.
// IsCompatible returns true if val is compatible with u.
func (u *UserTypeDefinition) IsCompatible(val interface{}) bool {
return u.Type == nil || u.Type.IsCompatible(val)
}
Expand Down
3 changes: 3 additions & 0 deletions goagen/gen_app/test_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,9 @@ func {{ $test.Name }}(t *testing.T, ctx context.Context, service *goa.Service, c
if !ok {
t.Errorf("invalid response media: got %+v, expected instance of {{ $test.ReturnType.Type }}", resp)
}
if mt == nil {
t.Errorf("nil response media type, expected instance of {{ $test.ReturnType.Type }}")
}
{{ if $test.ReturnType.Validatable }} err = mt.Validate()
if err != nil {
t.Errorf("invalid response media type: %s", err)
Expand Down

0 comments on commit 72202fd

Please sign in to comment.