Support for multiple default content types
Enhance FixedContentNegotiationStrategy and places where it is exposed to also accept a list of media types. Issue: SPR-15367
This commit is contained in:
committed by
Rossen Stoyanchev
parent
95e78b16f7
commit
4a890226ea
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,7 +20,6 @@ import java.util.Collections;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.mock.web.test.MockHttpServletRequest;
|
||||
import org.springframework.web.accept.ContentNegotiationManager;
|
||||
@@ -111,6 +110,14 @@ public class ContentNegotiationConfigurerTests {
|
||||
|
||||
assertEquals(Arrays.asList(MediaType.APPLICATION_JSON), manager.resolveMediaTypes(this.webRequest));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setMultipleDefaultContentTypes() throws Exception {
|
||||
this.configurer.defaultContentType(MediaType.APPLICATION_JSON, MediaType.ALL);
|
||||
ContentNegotiationManager manager = this.configurer.getContentNegotiationManager();
|
||||
|
||||
assertEquals(Arrays.asList(MediaType.APPLICATION_JSON, MediaType.ALL), manager.resolveMediaTypes(this.webRequest));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setDefaultContentTypeStrategy() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user