You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/04/04 03:11:41 UTC

[GitHub] nickva commented on issue #120: Update docs for PUT attachments

nickva commented on issue #120: Update docs for PUT attachments
URL: https://github.com/apache/couchdb-documentation/pull/120#issuecomment-291381935
 
 
   Thanks for taking a look. In this case I wanted to check because wasn't sure. I still see those headers as valid thought. Here is how I tested:
   
   (Used latest master, then python-couchdb in ipython prompt and httpie command line tool)
   
   ```
   In [22]: db
   Out[22]: <Database u'db'>
   
   In [27]: db.put_attachment(d1, 'tttttttttttttttttttttttttttttttttttttttttttt', 't1', content_type='text/plain')
   
   In [28]: db.put_attachment(d1, 'tttttttttttttttttttttttttttttttttttttttttttt', 'b1', content_type='application/blah')
   ```
   
   Created a db `db` and doc `d1`. Then created two attachments: one with a `text/plain` and another with `application/blah` mime types. The `text/plain` is special because in config options we specify that it can be compressed
   
   ```
   [attachments]
   compression_level = 8 ; from 1 (lowest, fastest) to 9 (highest, slowest), 0 to disable compression
   compressible_types = text/*, application/javascript, application/json, application/xml
   ```
   
   Listing the attachments we see that text/* one we get the Content-Encoding and the Content-Length as compressed values. But interestingly (but not surprising) we can't do Accept-Range requests for it.
   
   ```
   ~/asf (master)$ http http://adm:pass@localhost:15984/db/d1/t1
   HTTP/1.1 200 OK
   Accept-Ranges: none
   Cache-Control: must-revalidate
   Content-Encoding: gzip
   Content-Length: 24
   Content-MD5: L5mFG13zKQUGqeARUOwUkQ==
   Content-Type: text/plain
   Date: Tue, 04 Apr 2017 02:59:27 GMT
   ETag: "L5mFG13zKQUGqeARUOwUkQ=="
   Server: CouchDB/2.0.0-b9e7e12 (Erlang OTP/19)
   
   tttttttttttttttttttttttttttttttttttttttttttt
   
   ~/asf (master)$ http http://adm:pass@localhost:15984/db/d1/b1
   HTTP/1.1 200 OK
   Accept-Ranges: bytes
   Cache-Control: must-revalidate
   Content-Length: 44
   Content-MD5: 52wzeuub4aG8rDtYd947mA==
   Content-Type: application/blah
   Date: Tue, 04 Apr 2017 03:02:34 GMT
   ETag: "52wzeuub4aG8rDtYd947mA=="
   Server: CouchDB/2.0.0-b9e7e12 (Erlang OTP/19)
   
   tttttttttttttttttttttttttttttttttttttttttttt
   ```
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services