Quantcast

HEAD requests aren't working, am I doing them wrong?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

HEAD requests aren't working, am I doing them wrong?

Nolan Darilek
I'm trying to use Dispatch to fetch items in an Android app, displaying them in a variety of ways based on their content-type. In some instances, the type isn't immediately available, so I'd like to do a HEAD request on the URL and retrieve the Content-Type header.

I use <:> to do this, and it works, but according to the logs it is performing a GET request to retrieve the headers. Not only is that not what I want, but some of these files are rather large, meaning sometimes I'm waiting seconds or minutes to get their content-types. This of course generates an ANR, and while I acknowledge that I should move this work into a background thread, it doesn't seem that looking up the content type of an MP3 should have to GET the file first.

Am I missing something in either Dispatch or the HTTP spec? This is under Dispatch 0.7.8.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: HEAD requests aren't working, am I doing them wrong?

n8han
Administrator
You need to specify the HEAD method, e.g.

    req.HEAD >:> { ...

http://sourced.implicit.ly/net.databinder/dispatch-http/0.7.8/dispatch/Http.scala.html#20068


On 04/12/2011 10:53 AM, Nolan Darilek [via Databinder] wrote:
I'm trying to use Dispatch to fetch items in an Android app, displaying them in a variety of ways based on their content-type. In some instances, the type isn't immediately available, so I'd like to do a HEAD request on the URL and retrieve the Content-Type header.

I use <:> to do this, and it works, but according to the logs it is performing a GET request to retrieve the headers. Not only is that not what I want, but some of these files are rather large, meaning sometimes I'm waiting seconds or minutes to get their content-types. This of course generates an ANR, and while I acknowledge that I should move this work into a background thread, it doesn't seem that looking up the content type of an MP3 should have to GET the file first.

Am I missing something in either Dispatch or the HTTP spec? This is under Dispatch 0.7.8.

Thanks.


If you reply to this email, your message will be added to the discussion below:
http://databinder.3617998.n2.nabble.com/HEAD-requests-aren-t-working-am-I-doing-them-wrong-tp6265457p6265457.html
To start a new topic under Databinder, email [hidden email]
To unsubscribe from Databinder, click here.

Loading...