PurpleKingdomGames / tyrian

Elm-inspired Scala UI library.
https://tyrian.indigoengine.io/
MIT License
346 stars 26 forks source link

Unable to upload an image file to the server via HTTP #266

Open a-khakimov opened 4 months ago

a-khakimov commented 4 months ago

I couldn't figure out how to upload an image file to the server using the HTTP method with Tyrian. I couldn't find any code examples. Help me please to understand how to do this correctly.

Questions:

Thank you for your help!

davesmith00000 commented 4 months ago

Hi @a-khakimov, sorry for the slow reply and thank you for the pull request, I shall take a look!

The short answer is that I don't know off the top of my head. It is quite probably an oversight and that you are the first person to try this with Tyrian's HTTP client. If that's the case we should of course fix it, thank you for reporting. :pray:

I feel like @hobnob must have done stuff like this with Tyrian though? Maybe we can summon him by invoking his name... :smile:

I don't feel great about having to recommend this, just because we should support images out of the box, but as a work-around you can also use http4s-dom (or any other Cats Effect / ZIO compatible client), which is a more fully featured HTTP Client. There is an example here: https://github.com/PurpleKingdomGames/tyrian/tree/main/examples/http4s-dom