开发者

Trouble with getting a CouchApp to output the correct mime type for an appcache

开发者 https://www.devze.com 2023-03-29 23:22 出处:网络
So in CouchDB, you can supposedly change mime types. In Futon you just have to go and edit the source of the document and change the content_type field on attachments in the _attachment field. Trouble

So in CouchDB, you can supposedly change mime types. In Futon you just have to go and edit the source of the document and change the content_type field on attachments in the _attachment field. Trouble is, when I do this so that an appcache file has the correct mime type (text/cache-manifest), and save the document, it doesn't save and the content_type field is just blank again "". Any tips on outputing the right mim开发者_StackOverflowe type?


Wow, that is weird.

You can work-around this problem by adding a Content-Type: text/cache-manifest header when you store the attachment.

I think this will not work from a browser because it overrides the Content-Type. You can use curl from the command-line to upload an attachment. You need to know the document's current _rev revision value.

curl -X PUT -H "Content-Type: text/cache-manifest" \
     --data-binary @/path/to/appcache/file         \
     http://localhost:5984/db/the_doc/cache.manifest?rev=123-abcdef


The _attachments object is not user editable, which explains why your update did not work as expected. The most you can do with _attachments is to remove attachments completely by removing them from the object.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号