rest api – Custom WP API endpoint NULL body data

I have a weird issue, that bashes my head in. It’s probably something minor that I am overlooking, but for the life of me I cannot figure it out.

Here’s the premise:

  • I am making a POST request to a custom registered api endpoint in a wp environment, to which i am sending json data from a form. Content type is set correctly and if i debug by dumping $request->get_body() it shows the correct data that i’ve passed on.
  • however, i also send base64 encoded image data, resulted from a file reader. If i add another item to the data being send and the base64 string as the value for it, the dump becomes NULL. Taking the base64 string out of the json, makes the dump become ok again.

I have also tried to increase the max upload size, and post size however, since the file i am using as test is 20 KB, I do not think this is the issue.

I am hoping somebody can help me see the error of my ways.

Note that there are no errors in the json being sent, as I validated it manually with https://jsonformatter.curiousconcept.com/