Unity WebRequest Content Type issue

Recently I have been trying to do basic Web post requests and for some reason the inconsistency in Unity’s web request system is slightly causing frustration.

In Unity 2022 you can do this
UnityWebRequest www = UnityWebRequest.Post(sparqlEndpointURL, sparqlQuery, “application/sparql-query”);

Which creates a post request with a content-type of application/sparql-query

Unfortunately, for breaking changes in AR Foundation, we need to stick to Unity version 2021… where this code doesn’t work. I thought it would be as straight forward as writing this instead:

UnityWebRequest www = UnityWebRequest.Post(sparqlEndpointURL, sparqlQuery);
www.SetRequestHeader(“Content-Type”, “application/sparql-query”);

but no, doesn’t work :slight_smile:

Is there a way we can see what actually is being sent so that I know where the problem is.

So I have solved this after reading the solution to this question:

https://forum.unity.com/threads/unity-2021-unitywebrequest-native-collection-memory-leak.1175612/#post-7529222