On Tue, Apr 20, 2010 at 8:58 AM, J Chris Anderson <[email protected]> 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
>
>

Reply via email to