Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save max-mapper/960092 to your computer and use it in GitHub Desktop.
Save max-mapper/960092 to your computer and use it in GitHub Desktop.
spec for specifying custom headers on attachments in couchdb
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
@jamesdavidson
Copy link

Great idea! As far as I can tell, it has not been implemented as yet, any chance of that happening soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment