codeconsole opened a new issue, #15617: URL: https://github.com/apache/grails-core/issues/15617
### Expected Behavior
# Grails core should not silently fall back to createDefaults() in
getMimeTypes() — when there's no request,
it should defer caching, not poison it.
`org.grails.web.mime.HttpServletResponseExtension.getMimeTypes()`
```java
public static MimeType[] getMimeTypes() {
if (mimeTypes == null) { // ← static
field, populated once
webRequest = GrailsWebRequest.lookup(); // ←
thread-local request lookup
ApplicationContext ctx = webRequest?.getApplicationContext();
if (ctx != null) {
// CORRECT PATH: read app config via Spring
mimeTypes = ctx.getBean(MimeUtility).getKnownMimeTypes();
loadMimeTypeConfig(ctx.getBean(GrailsApplication).config);
} else {
// WRONG-FALLBACK PATH:
mimeTypes = MimeType.createDefaults(); // [XHTML, HTML,
XML, ...]
}
}
return mimeTypes;
}
```
### Actual Behaviour
_No response_
### Steps To Reproduce
_No response_
### Environment Information
_No response_
### Example Application
_No response_
### Version
7.0.10
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
