+1 for the patch, namely, adding a single newline at the end of all
couchdb-generated JSON documents and responses.

Pros:
- more convenient for command-line HTTP client use
- more convenient for saving and editing documents off-line
- more convenient for concatenating multiple responses into a single file

Cons:
- miniscule bandwidth penalty
- err, that's it

Any conformant(*) JSON parser will accept the newline, and in any case we
already insert some arbitary newlines within certain query responses, so we
are relying on clients having this capability.

I don't think HTTP specs are important here. This is application/json, not
text/json. In any case we may return JSON with arbitrarily long line
lengths.

Having the newline is just a feature which (IMO) can make couchdb data a
little friendlier for its consumers.

One might argue whether it should be \n or \r\n though :-(

Regards,

Brian.

(*) www.json.org says "Whitespace can be inserted between any pair of
tokens", without making it clear if end-of-file is a token, but RFC 4627 is
much clearer.

Reply via email to