openrightsgroup / blocked-org-uk

Template front-end code, markup, style-sheets, images and other assets for the Censorship Monitoring Project (blocked.org.uk)
https://www.blocked.org.uk/
GNU General Public License v3.0
13 stars 5 forks source link

Use json-seq for line-based json responses #409

Open gwire opened 2 years ago

gwire commented 2 years ago

A request for https://www.blocked.org.uk/stream-results?url=http%3A//www.example.com will currently include the content declaration

Content-Type: text/html; charset=utf-8

but the result is actually multiple lines containing json objects.

Please use JSON text sequences, per RFC 7464 with the content declaration

Content-Type: application/json-seq

Also, see this note.

dantheta commented 2 years ago

Good catch. The stream-results response isn't fully compliant with the RFC (no ascii record separator, only newlines). I've set it to application/json for now, and when I have more time to test I'll update the parser and mimetype to json-seq.