Getting the content type of an attachment

24 views
Skip to first unread message

Miikka Miettinen

unread,
Feb 14, 2012, 5:04:54 AM2/14/12
to Clojure Clutch
Hi,

Thanks for creating Clutch! It's very useful and seems to be working
really well.

One thing that I haven't been able to figure out is how to get the
content type of an attachment without making a second query. I might
for example have a mixture of gif, jpeg and png images as attachments,
and the format might not necessarily be encoded in the name of the
attachment. Is there a way to get it from the HttpURLConnection
$HttpInputStream that get-attachment returns? If not, it might be
useful to have get-attachment return a map (e.g. {:content-type "image/
jpeg", :input-stream ...}).

Best regards,
Miikka

Chas Emerick

unread,
Mar 21, 2012, 2:49:58 PM3/21/12
to Clojure Clutch
Sorry for missing this message earlier.

The HTTP API that Clutch calls for get-attachment does return the
content type of the returned resource. We might be able to add
another couple of vars that you can opt into binding that would be
populated with the content type and attachment size. This would allow
the return of get-attachment to remain an inputstream, but provide
access to those auxiliary return datums.

If you could, please open a ticket on the repo (https://github.com/
clojure-clutch/clutch) for this.

Thanks,

- Chas


On Feb 14, 6:04 am, Miikka Miettinen <miikka.mietti...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages