Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Binary response support (application/octet-stream) #44

Closed
stepankuzmin opened this issue Dec 9, 2016 · 2 comments
Closed

Binary response support (application/octet-stream) #44

stepankuzmin opened this issue Dec 9, 2016 · 2 comments

Comments

@stepankuzmin
Copy link

Hi there! It seems that cash doesn't support binary responses (like application/octet-stream).

Eg. I'm trying to response with pbf like

ctx.body = Buffer.from(geobuf.encode(geojson, new Pbf()));

And getting

Error: Place koa-cache below any compression middleware.;

My response headers are:

HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/octet-stream
Content-Length: 2227
Content-Encoding: identity
ETag: "8b3-CASiLhVb9Ldvy7npP1sNNQ"
Date: Fri, 09 Dec 2016 14:40:13 GMT
Connection: keep-alive
@lbeschastny
Copy link
Contributor

lbeschastny commented Dec 9, 2016

Hi.

This exception should occur when you register some compression middleware after registering cash, i.e.:

app.use(cash()) // WRONG!
app.use(compress())

cash should support binary responses, but underlying cache implementation should allow storing Buffer objects.

@stepankuzmin
Copy link
Author

Oh, right. I've somehow missed it. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants