hubertlepicki
Does anyone here know of an Elixir library which would help me assemble bodies of HTTP requests with “multipart/form-data” Content-type?
This would be the reverse of plug/lib/plug/parsers/multipart.ex at v1.8.2 · elixir-plug/plug · GitHub i.e. parsing “multipart/form-data” requests by Plug.
Ideally I could either assemble it and get it as String, or in streaming form (for large file uploads).
Hackney does that and I can try translating that to Elixir, but would be ideal if I didn’t have to for obvious reasons :D.
Does anyone know of a piece of Elixir code that does that, even if it’s part of bigger library?
Trending in Discussions
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
New
The obligatory hello world thread!
Who are you and where are you from? :stuck_out_tongue:
New
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project.
My initial shotgu...
New
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
Just a general thread to post chat/news/info relating to AI/ML stuff that may be relevant for Nx now or in the future. Got anything to sh...
New
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
Other Trending Topics
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve.
They are GUI (Emerge) and State management (S...
New
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
While I am working on the Language Agnostic Code Audit SaaS, which uses MetaAST (spoiler: I am expecting it to be in a good shape for ann...
New
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #phoenix_html
- #iex
- #graphql
- #ai
- #genstage
- #elixirconf-us
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex











First 10 of 35 Posts
jola
HTTPoison wraps hackney so you can avoid translating and supports multipart. Haven’t used it for this myself.
https://github.com/edgurgel/httpoison#multipart
hubertlepicki
Thanks. A bit of a background I should have posted: I want to avoid using HTTPoison / hackney and use either mint directly or with a wrapper called mojito. Unfortunately these don’t have part that assembles “multipart/form-data” requests, so I either have to find one from some other library, or write one myself.
jola
Ah, I see. Yeah, since they’re pretty new and Mint itself is not necessarily designed for “regular” use cases (although mojito is), you’re likely to have to write something yourself if mojito doesn’t support it.
Out of curiosity, why does it have to be mint?
hubertlepicki
Hackney has got issues that I stumbled upon recently (among others before), but I don’t think I like how it depends on application configuration either, things get quite difficult once you have to deal with SSL / self-signed certificates or client SSL authentication. And I had fair amount of issues on production with using it too, although not recent. There’s a thread on this forum from 2017 where I argued we need a better built-in HTTP client library in Elixir itself.
Mint comes as close as it gets to what I wanted the standard HTTP client to be, it’s idiomatic Elixir, it’s low level enough that you can build idiomatic clients on top of it (like mojito) and from what I saw really like it’s design. It’s a good reading if one wants to learn how to deal with TCP/SSL connections in Elixir too. Very educational
I think I prefer to put in some effort working on getting it up to desired shape myself rather than plan for another battle agains HTTPoison/hackney.
jola
Got it, that makes sense
I’ve had some obscure problems with HTTPoison (hackney) too, although nothing I couldn’t just ignore…
NobbZ
teslacan do MultiPart on all of its backends as far as I know… You are free too choose betweenhackeny,httpcandibrowseIIRC…hubertlepicki
@NobbZ ah, great catch! It’s there indeed: tesla/lib/tesla/multipart.ex at master · elixir-tesla/tesla · GitHub
I’ll have to think on how to extract this possibly to shared lib but for now I can just include tesla as a proof of concept.
NobbZ
Ah, so you do not actually want to send the request, you just want to have the encoded body?
Then I missunderstood your intial question, but I’m happy that I still was able to help
hubertlepicki
You did but that’s helpful anyway, I was counting on such example code but didn’t think about Tesla.
ijunaidfarooq
does Finch support multipart data request?