Oct 8, 2022
The Mexico City Circus Festival is one of the biggest and most ambitious in the world. The circus and paseo circus was born in 1882 in Mexico City. Circuses, paseos and drag shows, were part of the big show called Festival de Circo. In the heart of the capital city, in “La Zona Rosa” and the “Zona Rosa”, the Festival starts the 30 days of free circus shows with entertaining ring for all visitors in beautiful venues.Q:
Whats wrong with this request?
I am making a request to a service, but I get an error every time.
$request = $this->getHttpClient()->createRequest();
$request->setUri($this->getBundle()->getBundleUrl('myBundle', '/my_route'))
->setMethod(HTTP_METHOD_POST);
$request->setHeaders([
'Content-Type' => 'application/json',
]);
$request->setContent($json);
$response = $this->getHttpClient()->send($request);
I get the following error message:
UnexpectedValueException: The data given to the setData method must be one of the accepted formats.
The request works if I remove this line:
->setHeaders([
'Content-Type' => 'application/json',
]);
I've also tried:
->setHeaders(
['Content-Type' => 'application/json']
);
I've tried putting a printout of the'setData' method, and all it sees is 'array' (which is what I set the data to be in the first place)
Please help, I can't seem to figure out what is wrong.
A:
Well, it looks like the request is sending the wrong format. By the way it looks like you are using Symfony Standard Edition, so try ac619d1d87
Related links:
Comments