added defer to call to prevent failure.

This commit is contained in:
Danny Adams 2023-01-06 09:37:40 -05:00
parent 103f4ccd2c
commit 9a872fd388

View File

@ -49,6 +49,8 @@ func (s Service) Client() *msgraphsdk.GraphServiceClient {
// application/json writer within the adapter.
func (s Service) Serialize(object absser.Parsable) ([]byte, error) {
writer, err := s.adapter.GetSerializationWriterFactory().GetSerializationWriter("application/json")
defer writer.Close()
if err != nil || writer == nil {
return nil, errors.Wrap(err, "creating json serialization writer")
}