couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anh <7za...@gmail.com>
Subject Re: Customize 404 response?
Date Tue, 20 Apr 2010 17:12:28 GMT
On Tue, Apr 20, 2010 at 8:58 AM, J Chris Anderson <jchris@gmail.com> wrote:
>
> On Apr 19, 2010, at 8:04 PM, 7zark7 wrote:
>
>> Hi,
>>
>> I was wondering if there is a way to return html content for 404 errors, instead
of the default json:
>>
>
> This isn't possible in a general way. The CouchDB API is JSON based.
>
> However, you can return custom 404s from a _show or _list function.
>
> http://books.couchdb.org/relax/design-documents/shows
>

Thanks Chris, I hadn't thought of that.

Though my current project involves working with a document's attachments,
and it seems show functions are unable to return the binary data for
attachments.  (Which includes images, videos, etc)

The only way I've been able to serve the attachment is via direct GET
request, or using the rewrite functionality.

Is my understanding correct?


Thanks




>> HTTP/1.1 404 Object Not Found
>> Server: CouchDB/0.11.0 (Erlang OTP/R13B)
>> Date: Tue, 20 Apr 2010 02:58:22 GMT
>> Content-Type: text/plain;charset=utf-8
>> Content-Length: 41
>> Cache-Control: must-revalidate
>>
>> {"error":"not_found","reason":"missing"}
>>
>>
>> Thanks
>
>

Mime
View raw message