❔ Why does my response get capitalized?
or some weird ass reason this small piece of code capitalizes the string I write to it. Notice
false
is not capitalized, but the actual response is. Why does this happen and how can I prevent this?10 Replies
Are you sure that's not just Postman capitalizing it?
No, my frontend also receives it like this
It's currently set as 'Pretty' which may format it.
This is a problem because it's not parsed as a boolean anymore
Maybe .NET uses
.ToString()
for the bool, which evaluates to True/False
I doubt it since that would make it a string, and this is not even a string but a literal capitalized boolean value
You might be right actually. I just checked and I expected quotes to form but it remains the same pretty much
You are correct.
This is weird though. I parse it beforehand so responseObject is a object holding a boolean. Why would it call ToString()?
I have been working around the whole middleware in general, and I found out a way to copy the stream early before it even has to bother with the parsing or writing in general. This fixes my issue, but I wonder why this this happens in general?
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.