Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 99498 invoked from network); 21 Apr 2009 19:52:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 21 Apr 2009 19:52:25 -0000 Received: (qmail 4936 invoked by uid 500); 21 Apr 2009 19:52:24 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 4855 invoked by uid 500); 21 Apr 2009 19:52:23 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 4845 invoked by uid 99); 21 Apr 2009 19:52:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 19:52:23 +0000 X-ASF-Spam-Status: No, hits=1.2 required=10.0 tests=SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [209.85.200.175] (HELO wf-out-1314.google.com) (209.85.200.175) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Apr 2009 19:52:15 +0000 Received: by wf-out-1314.google.com with SMTP id 28so2871326wfa.29 for ; Tue, 21 Apr 2009 12:51:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.166.7 with SMTP id o7mr166068wfe.137.1240343514264; Tue, 21 Apr 2009 12:51:54 -0700 (PDT) In-Reply-To: References: <1d3db2990904211228k1fcc29fie0f32ee280f05f02@mail.gmail.com> Date: Tue, 21 Apr 2009 12:51:54 -0700 Message-ID: <1d3db2990904211251u1032b36en6527b772dc3901bd@mail.gmail.com> Subject: Re: specify Content-Type of a document? From: Samuel Wan To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I'm trying to build a simple learning experiment where I can write HTML and Javascript into documents, and retrieve them with a GET request. However, I don't know how to specify text/html or application/x-javascript as the Content-Type headers in the response to a document request. Is the recommended practice to simply store the html or js text as attachments, or is it possible somehow to use a "show" function to send them back with specific content type headers? I read some of Chris Anderson's posts, the Safari Rough Cuts book, and looked a bit at the CouchApp code, but it might be too much to grasp all at once for me. -Sam On Tue, Apr 21, 2009 at 12:33 PM, Paul Davis wrote: > Sam, > > We're consistently inconsistent in that we only sometimes check for > the content-type when posting JSON documents. Of the top of my head I > know we check in _temp_views but not for PUTs and POSTs to docs or > _bulk_docs. > > If you mean for adding attachments to docs though CouchDB will just > send you back the content-type header you attached it with so you can > control what clients will see when fetching attachments. > > HTH, > Paul Davis > > On Tue, Apr 21, 2009 at 3:28 PM, Samuel Wan wrote: >> Is it possible to specify the Content-Type header of a document? Do >> you need to use a "show" function? >> >> -Sam >> >