<FromGitter>
<mixflame> i tried to port generated net/http code to crystal
<FromGitter>
<mixflame> {"data":{"error":"No image data was sent to the upload api","request":"\/3\/image","method":"POST"},"success":false,"status":400}
DTZUZU has joined #crystal-lang
<FromGitter>
<Blacksmoke16> Would help if you provided the error or a hint of what's not working
<FromGitter>
<mixflame> it seems like content-length is getting set to 0 even tho i have a body? could be a crystal bug or me doin something wrong. the form posts and then imgur returns that hash
<FromGitter>
<Blacksmoke16> mm do you need to do `io.rewind` first?
<FromGitter>
<hedgehog1029> there is definitely some bad code happening there
DTZUZU_ has quit [Ping timeout: 265 seconds]
<FromGitter>
<naqvis> also do you really need to code those content-dispositions yourself?
<FromGitter>
<mixflame> the field are part of the imgur api
<FromGitter>
<naqvis> i would suggest to take a look at `HTTP::FormData#build` documentation
<FromGitter>
<hedgehog1029> yeah the `FormData::Builder` will help out here
<FromGitter>
<hedgehog1029> also just use `client.post`
<FromGitter>
<mixflame> i'm using `FormData::Builder` in the code, just think i'm using it wrong
<FromGitter>
<hedgehog1029> you will need to rewind the IO also
<FromGitter>
<hedgehog1029> but you're doing weird bits like converting the IO to a string
<FromGitter>
<hedgehog1029> yeah that example is good
<FromGitter>
<mixflame> there's a bug in crystal or amber
<FromGitter>
<mixflame> that code produces File path: {"data":{"error":"No image data was sent to the upload api","request":"\/3\/image","method":"POST"},"success":false,"status":400} too
<FromGitter>
<Blacksmoke16> Did you rewind the Io?
deavmi has quit [Ping timeout: 260 seconds]
<FromGitter>
<mixflame> i tried rewinding a few times and that did nothing
<FromGitter>
<mixflame> i think it's failing to send the content-length, there's a bug when specifying content-length, it doesn't permit the request to be sent
chachasmooth has quit [Ping timeout: 260 seconds]
chachasmooth has joined #crystal-lang
<FromGitter>
<mixflame> i think there is definitely a bug in crystal, this 500's for no reason
<FromGitter>
<naqvis> so it was missing `content_length` attribute which was causing the problem?
DTZUZU has quit [Ping timeout: 252 seconds]
early has quit [Quit: Leaving]
early has joined #crystal-lang
DTZUZU has joined #crystal-lang
DTZUZU_ has quit [Ping timeout: 240 seconds]
<FromGitter>
<mixflame> yes missing content length for one and body and content length had to match
<FromGitter>
<mixflame> and the file had to be named "image" and not "file"
<FromGitter>
<naqvis> 👍
DTZUZU_ has joined #crystal-lang
DTZUZU has quit [Ping timeout: 240 seconds]
hendursaga has quit [Ping timeout: 240 seconds]
hendursaga has joined #crystal-lang
sz0 has joined #crystal-lang
deavmi has quit [Ping timeout: 260 seconds]
deavmi has joined #crystal-lang
<FromGitter>
<Daniel-Worrall> `true ? a = 1 : a = nil` The compiler currently treats `a` as `Int32?`. Would it be easy for the compiler to not consider unreachable paths like this?
Stephanie is now known as Stephie
<FromGitter>
<asterite> Yes, trivial if the condition is a true literal. Why do you need it, though?
deavmi has quit [Read error: Connection reset by peer]
deavmi has joined #crystal-lang
<FromGitter>
<Daniel-Worrall> I don't, I just figure it might help in cases of bad code (less in the case of a literal, more in the case of a truthy variable
<repo>
does the crystal mime multipart implementation support decoding quoted printable encoded text?
<repo>
i'm writing a mua in crystal and i have to deal with such horrors
<FromGitter>
<naqvis> repo i would say yes, it does
johnny101 has quit [Ping timeout: 240 seconds]
<repo>
that's good news
<repo>
naqvis: hm it looks like it just yields the body