Closed Gareth064 closed 4 months ago
@Gareth064 : When you do a batch request the HTTP response code typically is 200, but when the insides of the batch are inspected and there's something wrong we'll throw an error. I checked the code, and the HTTPStatus code you're getting is what SharePoint gave back to us. Relying on just the status code is not a good pattern here.
Yeah if it's always 200 then I definitely can't rely on the pattern 🤣
I will just have to build a middleware parser as they are quick and dirty, until I come up with something else.
Category
Describe the bug
I was just looking through some exception logs in my application and I notice that when a CSOM request fails, the message it returns says HttpResponseCode: 200. Here is an example.
Is this normal? Is it the PnP Core Library setting that code or is it direct from SPO?
Feels like it shouldn't be a 200 if the request failed.
Environment details (development & target environment)
Additional context
I am trying to bubble the exception up to the client that is calling my Web Service, but I want to tailor my response code to either 400 or 500. So I was hoping to use the Response Code returned from SPO/PnP to inform my response.