❔ 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?![](https://utfs.io/f/c71cee69-7a14-465f-99ae-bf90dafc56dd-1nq2cb.png)
![](https://utfs.io/f/1b86a8ba-09d1-46b3-9ad0-ec97b966e05a-1nq2cb.png)
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.
![](https://utfs.io/f/8d4b9669-8dd2-4aa8-b18a-2f290eb6597c-1nq2cb.png)
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.