Skip to content

Commit

Permalink
fix(service): disable content negotiation via URI path extension
Browse files Browse the repository at this point in the history
fix a problem treating URIs that end with '.com' as a request for content-type
application/ms-download

turns out some people have email addresses that end with '.com'
  • Loading branch information
cfieber committed Mar 29, 2017
1 parent 15bfbbd commit afc0703
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

Expand Down Expand Up @@ -39,6 +41,12 @@ public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(interceptor);
}

@Override
public void configureContentNegotiation(ContentNegotiationConfigurer configurer) {
super.configureContentNegotiation(configurer);
configurer.favorPathExtension(false).defaultContentType(MediaType.APPLICATION_JSON);
}

@Bean
@ConditionalOnMissingBean(UserRolesProvider.class)
UserRolesProvider defaultUserRolesProvider() {
Expand Down

0 comments on commit afc0703

Please sign in to comment.