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

With the newest micro, this does nothing #2

Closed
luminarious opened this issue Sep 12, 2017 · 1 comment
Closed

With the newest micro, this does nothing #2

luminarious opened this issue Sep 12, 2017 · 1 comment

Comments

@luminarious
Copy link

This is my test index.js:

const {send, json} = require('micro')
const compress = require('micro-compress')

module.exports = compress({threshold: 0}, async (req, res) => {
	const body = `What is Lorem Ipsum?`
	send(res, 200, body)
})
@joakimbeng
Copy link
Owner

I totally missed this issue...

I've investigated it now using your code and running micro with: DEBUG=* micro which yields the following when doing a request:

micro: Accepting connections on port 3000
  compression undefined not compressible +0ms
  compression no compression: filtered +0ms

And when looking into micro's code, specifically the send function, you can see that the Content-Type header is not set for strings. By changing the body to an object the problem is solved.

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