ktor with with mustache 415 Unsupported Media Type: POST
See original GitHub issueKtor Version
1.1.2
Ktor Engine Used(client or server and name)
netty
JVM Version, Operating System and Relevant Context
java version 10.0.2 mac os
Feedback
i built a small app to test mustache with ktor but when i try to post data using html form in mustache file .hbs file the post gave me an
415 Unsupported Media Type: POST when i try to recieve a typed json
val param = call.receive<Quote>()
and also give me a null value when i try
val param = call.receive<Parameters>() val author = param["author"]!! val qouteText = param["quoteText"]!!
and this is my html form
` <form role="form" class="col-xs-3 text-center" style="width: 30%" action="/quotes" method="post" > <div class="form-group"> <label for="titleInput">Author</label> </div>
<div class="form-group">
<label for="quote">Quote</label>
<br>
<textarea class="form-control" id="quote" rows="3" required="required"></textarea>
</div>
<div class="text-center">
<button type="submit" class="btn btn-primary mb-2 text-center">Confirm</button>
</div>
</form>`
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:5
Top Results From Across the Web
ktor with with mustache 415 Unsupported Media Type: POST
This issue was imported from GitHub issue: https://github.com/ktorio/ktor/issues/925. Ktor Version. 1.1.2. Ktor Engine Used(client or server and name).
Read more >Ktor returns 415 from endpoints where receive() is used with ...
Firstly, ContentNegotiation feature works only for receiving custom objects from the payload of POST, PUT and PATCH requests:.
Read more >UnsupportedMediaTypeException - ktor
HTTP status 415 Unsupported Media Type will be replied when this exception is thrown and not caught. Constructors Functions Properties ...
Read more >Server-Side Kotlin with Ktor · API Post Endpoint
For the 415Unsupported Media Type error, sounds like there may be an issue with the request.json file that was created. What editor did...
Read more >https://raw.githubusercontent.com/ktorio/ktor/mast...
... results in 400 Bad Request instead of 415 Unsupported Media type ... form post ([KTOR-3342](https://youtrack.jetbrains.com/issue/KTOR-3342)) * Ktor test ...
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
Add Header “Content-Type”: “application/json” while sending request in postman, and don’t forget to add ContentNegotiation plugin in your ktor project.
Actually, this happens when we forgot to install ContentNegotiation with JSON. Don’t forget to add a dependency and plugin for serialization and request with the header “Content-Type”: “application/json”