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

[feat. req.]Maybe you can add an option to support custom mime? #349

Open
Yayure opened this issue Jul 1, 2020 · 0 comments · May be fixed by #351
Open

[feat. req.]Maybe you can add an option to support custom mime? #349

Yayure opened this issue Jul 1, 2020 · 0 comments · May be fixed by #351

Comments

@Yayure
Copy link

Yayure commented Jul 1, 2020

I read the send has custom configuration for mime.

send#custom-file-types

var http = require('http')
var parseUrl = require('parseurl')
var send = require('send')

// Default unknown types to text/plain
send.mime.default_type = 'text/plain'

// Add a custom type
send.mime.define({
  'application/x-my-type': ['x-mt', 'x-mtt']
})

var server = http.createServer(function onRequest (req, res) {
  send(req, parseUrl(req).pathname, { root: '/www/public' })
    .pipe(res)
})

server.listen(3000)

I don’t know how to test, so can you try this option?

@Yayure Yayure linked a pull request Jul 2, 2020 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant