I have a service which is using PutJsonToUrl or PostJsonToUrl aa needed to create or update records on a client’s API. Testing was going great until I had some foreign characters in my data. But, when I make the same requests using Postman they work fine.
I thought maybe this was an encoding issue that Postman was handling under the hood, but have had no luck in Utf-8 emcoding the content. If I remove the foreign characters it works fine so I’m fairly certain they are the cause. When they are included I get 400 Bad Request errors.
Without seeing your service code, this could be anything. Have you debugged to see if the characters are correctly represented when your service code first starts? You might have some validation code that is being hit? Try creating a minimal reproduction of the issue, if you are still having issues, post that minimal reproduction to a public GitHub and I’ll take a look.
Thank you very much for the offer, I was trying to figure out how to provide a reproduction with out exposing my client’s API when I noticed something in the Postman C# code snippet. It is using StringContent, so when I passed my Json in like this
var content = new StringContent(updateObject.data.ToJson(), null, "text/plain");
and used content in the Put
var tst = url.PutJsonToUrl(content, requestFilter: (req) =>
It worked. System.Net.Http.StringContent output a byte array and that did the trick.