When creating a ResourceResponse from a Resource, if you set the status code to anything not null, the headers you set will not be sent.
The problem is in
which will abort if data.getStatusCode() != null.
I see no reason to return from that branch.
My use case is implementing Partial Content, which requires both code 206 and custom headers. Our current workaround is overloading setResponseHeaders.