aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntoine Vigneau <antoine.vigneau@sonarsource.com>2025-05-23 15:21:42 +0200
committersonartech <sonartech@sonarsource.com>2025-05-26 20:03:40 +0000
commit0d5a4f78bef6ad1bb846c8f3dc5dc32ddd0a7b36 (patch)
treebbdc4515939690bbcb4c2b8355080de33f39627e
parentfebcf5bd7b53b3679238868f880802502e1e34ec (diff)
downloadsonarqube-0d5a4f78bef6ad1bb846c8f3dc5dc32ddd0a7b36.tar.gz
sonarqube-0d5a4f78bef6ad1bb846c8f3dc5dc32ddd0a7b36.zip
SONAR-25178 Default api/v2 content negotiation to JSON
-rw-r--r--server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java
index c19a6349125..dba11c19740 100644
--- a/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java
+++ b/server/sonar-webserver-webapi-v2/src/main/java/org/sonar/server/v2/config/CommonWebConfig.java
@@ -36,6 +36,7 @@ import org.springframework.context.annotation.PropertySource;
import org.springframework.http.MediaType;
import org.springframework.validation.Validator;
import org.springframework.validation.beanvalidation.SpringValidatorAdapter;
+import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -98,4 +99,9 @@ public class CommonWebConfig implements WebMvcConfigurer {
public BeanFactoryPostProcessor beanFactoryPostProcessor1(SpringDocConfigProperties springDocConfigProperties) {
return beanFactory -> springDocConfigProperties.setDefaultProducesMediaType(MediaType.APPLICATION_JSON_VALUE);
}
+
+ @Override
+ public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
+ configurer.defaultContentType(MediaType.APPLICATION_JSON, MediaType.ALL);
+ }
}