Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tilgovi/960094 to your computer and use it in GitHub Desktop.

Select an option

Save tilgovi/960094 to your computer and use it in GitHub Desktop.

Revisions

  1. tilgovi revised this gist May 7, 2011. 1 changed file with 4 additions and 5 deletions.
    9 changes: 4 additions & 5 deletions couchdb-custom-header-attachments.txt
    Original file line number Diff line number Diff line change
    @@ -23,8 +23,7 @@ Host: localhost
    Accept: */*
    Content-Type: image/jpeg
    Content-Length: 424129
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Methods: GET, POST, OPTIONS
    Access-Control-Allow-Headers: Content-Type
    Access-Control-Max-Age: 86400
    Whatever-You-Want: Gets stored
    X-Couch-Attachment-Header: Access-Control-Allow-Origin: *
    X-Couch-Attachment-Header: Access-Control-Allow-Methods: GET, POST, OPTIONS
    X-Couch-Attachment-Header: Access-Control-Allow-Headers: Content-Type
    X-Couch-Attachment-Header: Access-Control-Max-Age: 86400
  2. @max-mapper max-mapper created this gist May 7, 2011.
    30 changes: 30 additions & 0 deletions couchdb-custom-header-attachments.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    INLINE ATTACHMENT

    {
    _attachments: {
    "awesome.jpeg": {
    content_type: "image/jpeg",
    data: "base64 data goes here",
    headers: {
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Methods": "GET, POST, OPTIONS",
    "Access-Control-Allow-Headers": "Content-Type",
    "Access-Control-Max-Age": "86400",
    "Whatever-You-Want": "Gets stored"
    }
    }
    }
    }

    STANDALONE ATTACHMENT

    PUT /db/id/awesome.jpeg?rev=2-c9b53a4004d3ef5dc290bbb06c672e61 HTTP/1.1
    Host: localhost
    Accept: */*
    Content-Type: image/jpeg
    Content-Length: 424129
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Methods: GET, POST, OPTIONS
    Access-Control-Allow-Headers: Content-Type
    Access-Control-Max-Age: 86400
    Whatever-You-Want: Gets stored