Is it possible to have multiple ContentNegotiation, separate per module?
See original GitHub issueKtor Version
1.1.2
When trying to install ContentNegotiation inside additional (not main) module:
install(ContentNegotiation) {
register(ContentType.Application.Xml, MyContentConverter()) {
}
}
I have this error:
Caused by: io.ktor.application.DuplicateApplicationFeatureException: Conflicting application feature is already installed with the same key as `ContentNegotiation`
however I would like that part of the routes could by default use different content negotiation. some API require to have XML.
The per route can be defined with help of contentType
:
routing {
contentType(ContentType.Application.Xml){
get("/myxml/api"){
}
}
Is there way to have that configured per module, how the ContentNegotiation happens?
That would help to have modules as separate dependencies to be reused on different Ktor applications.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Content negotiation and serialization
The ContentNegotiation plugin serves two primary purposes: Negotiating media types between the client and server. For this, it uses the ...
Read more >NancyFx per module or per route serialization
I have a single return type per module, but in different URL routes I need to serialize it differently, just specific properties. If...
Read more >Content Negotiation - Apache HTTP Server Version 2.4
Content negotiation is provided by the mod_negotiation module, which is compiled in by ... A resource may be available in several different representations....
Read more >Enable header-based proactive content negotiation with ...
By HEAD not currently honoring an unambiguous Accept header, we have the following bug: - Perform jQuery.ajax('/node/1', {'headers': {'accept': ...
Read more >Spring Boot Multi Module Project
Spring Boot Multi Module Project with Introduction, Features, Project, ... so we need not to specify the same dependency in each module separately....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi, since 2.0.0 it’s possible to install different
ContentNegotiation
plugins for separate routesPlease check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.