panoramicdata / ServiceNow.Api

ServiceNow REST API nuget package
MIT License
21 stars 18 forks source link

Null return issue #2

Open UnaffiliatedCode opened 3 years ago

UnaffiliatedCode commented 3 years ago

.Net Core version 3.1 Build version 1.2.27 File: ServiceNowClient.cs Line:

(await this.GetDeserializedObjectFromResponse<RestResponse<JObject>>(response, Guid.NewGuid()).ConfigureAwait(false)).Item

This line is replicated in a few places, and causes an issue if the Rest application returns a null. With a status code 200/201/etc.

A nullable check, and return null would suffice for my purposes. I was going to write the change and submit a P.R. however it appears that you fixed this, but only support .Net version 5.0 with that change.

Can there be a version 3.0 compatible build?

davidnmbond commented 3 years ago

Hi @UnaffiliatedCode!

I'm happy to fix this one, but I could do with understanding the circumstances in which a 200/201 returns null / empty string. Could you provide a small code snippet?

UnaffiliatedCode commented 3 years ago

In my example, this table is a customized set of code that is done for communication between different systems. My calling method is a simple CreateAsync call, that is being managed on the ServiceNow side to return a null (not controllable by me).

So unfortunately, I cannot provide the exact circumstances/code required to replicate on your end. :(

In my use-case, a simple return null would suffice.