401 http responses generated by Expressive\Authentication\BasicAccess have Content-type: text/html; charset=UTF-8
. I would like to return application/json
.
- One way is to create custom BasicAccessFactory.
- Second way is to modify BasicAccessFactory to pull custom $responseFactory from $container if provided in config under
authentication
.
Your opinions?
Curious what you did here. The default response factory in Expressive produces simply an empty Zend\Diactoros\Response
which does not come with a content-type
out of the box. So something else is adding that header – maybe via content negotiation. My sense tells me that manipulating the content type via the BasicAccessFactory
isn’t ideal. I wonder if you ran a request with a proper json Accept
header if you’d get the json content-type
in the response.