question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

415 Unsupported media type only through Fuel

See original GitHub issue

Hi, I have a server I am trying to reach to. If I open a browser and simply enter the url of my endpoint, I can see the response. If I use curl curl localhost:9090/api/some-get-endpoint I can see the response. Even when I try it in Postman, and create a simple GET request, it works. But if I try to reach the server using Fuel I get 415 Unsupported Media Type.

This is the code I am running:

    FuelManager.instance.basePath = "http://$host:$port/api"

    "/position"
                .httpGet()
                .responseString(handler).join()

And the full error:

HTTP Exception 415 Unsupported Media Type
	com.github.kittinunf.fuel.core.FuelError$Companion.wrap(FuelError.kt:84)
	com.github.kittinunf.fuel.core.FuelError$Companion.wrap$default(FuelError.kt:83)
	com.github.kittinunf.fuel.core.requests.RequestTaskCallbacks.call(RequestTaskCallbacks.kt:30)
	com.github.kittinunf.fuel.core.requests.RequestTaskCallbacks.call(RequestTaskCallbacks.kt:20)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	java.lang.Thread.run(Thread.java:748)
Caused by: HTTP Exception 415 Unsupported Media Type
	com.github.kittinunf.fuel.core.FuelError$Companion.wrap(FuelError.kt:86)
Caused by: com.github.kittinunf.fuel.core.HttpException: HTTP Exception 415 Unsupported Media Type
	com.github.kittinunf.fuel.core.requests.RequestTask.prepareResponse(RequestTask.kt:35)
	com.github.kittinunf.fuel.core.requests.RequestTask.call(RequestTask.kt:47)
	com.github.kittinunf.fuel.core.requests.RequestTask.call(RequestTask.kt:14)
	com.github.kittinunf.fuel.core.requests.RequestTaskCallbacks.call(RequestTaskCallbacks.kt:28)
	com.github.kittinunf.fuel.core.requests.RequestTaskCallbacks.call(RequestTaskCallbacks.kt:20)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	java.lang.Thread.run(Thread.java:748)

I am sure I am missing something stupid, but I don’t see what…

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rehovicovacommented, Oct 22, 2020

I swapped to kohttp, the problem is gone. If you want to further investigate the issue with Fuel I was using version 2.2.3and then I swapped to the latest 2.3.0. Both of them were buggy for me.

0reactions
kittinunfcommented, Oct 26, 2020

I will try to fork the C++ and see what is going on there. Sorry! and Thanks for the report! 🙇

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Status 415 - Unsupported Media Type when doing POST
My code and part of the screen shot is included, the pair for the hashmap I tried is duration and 150 . I...
Read more >
415 Unsupported Media Type - KeyCDN Support
A 415 Unsupported Media Type error occurs when the origin server refuses a particular request since the resource is in a format that...
Read more >
esriRequest returnes "415 Unsupported media type"
esriRequest returnes "415 Unsupported media type" with js aspi 4.12. 337. 1. 07-16-2019 03:16 AM. deleted-user-OOe4JK-9Abnm. by deleted-user-OOe4JK-9Abnm.
Read more >
415 Unsupported MediaType in Spring Application - Baeldung
There are two options in front of us to resolve the issue. The first option is to change the request payload format according...
Read more >
Connection with API error code 415: Unsupported Media Type
try hardcoding Name Content-Type with a Value of application/problem+json in your header tab in the download tool. my usual strategy is run in ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found