when I have these options:
:media-type #{"text/plain"
#_"application/octet-stream"}
I get the response as a viewable text file in the browser. But when I add "application/octet-stream"
, it won’t show in the browser but becomes a download, although the request/response headers seem identical. Any idea?Download:
Connection: Keep-Alive
Content-Length: 2053470
Content-Type: text/plain
Date: Thu, 06 Dec 2018 13:17:18 GMT
Server: Aleph/0.4.4
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Viewable as plain text:
Connection: Keep-Alive
Content-Length: 2053470
Content-Type: text/plain
Date: Thu, 06 Dec 2018 13:19:14 GMT
Server: Aleph/0.4.4
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
That's odd. Try adding a q value
Could you raise an issue? Worth capturing this.
:media-type #{"text/plain; q=1"
"application/octet-stream; q=0.9"}
seems to work OKAre you somehow manually setting Content-Type in the response in your code?
nope, I return a string as the response
{:swagger/tags ["articles"]
:produces
{:media-type #{"text/plain; q=1"
"application/octet-stream; q=0.9"}}
:methods
{:get
{:swagger/summary "Export search results to nbib format"
:parameters {:query {(s/optional-key :limit) s/Int
:blunt String
(s/optional-key :format) String}}
:response
(fn [ctx]
... <- string)}}}