Sunday, 7 July 2019

Laravel test POST routes with XML

I've looked at this question, but it's not quite what I'm after.

I have a API endpoint in a Lumen application that takes in XML. Within the controller, I'm reading data by doing this: $request->getContent();.

I'm trying to write a unit test that posts XML to a route and retrieve the response. I tried this $response = $this->call('POST', '/api', $xml);, but the third parameter has to be an array, not a string.

How would I post an XML string to an endpoint in a unit test?



from Laravel test POST routes with XML

No comments:

Post a Comment