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

Why using binary for 'application/javascript' and alike? #131

Closed
Vadorequest opened this issue Mar 9, 2018 · 5 comments
Closed

Why using binary for 'application/javascript' and alike? #131

Vadorequest opened this issue Mar 9, 2018 · 5 comments

Comments

@Vadorequest
Copy link

I don't understand why you use a binary mime type for

const binaryMimeTypes = [
  'application/javascript',
  'application/json',
  'application/octet-stream',
  'application/xml',
  'font/eot',
  'font/opentype',
  'font/otf',
  'image/jpeg',
  'image/png',
  'image/svg+xml',
  'text/comma-separated-values',
  'text/css',
  'text/html',
  'text/javascript',
  'text/plain',
  'text/text',
  'text/xml'
];

I think it makes sense for image/* (because png/jpg are treated as binary format by API Gateway and won't be displayed without this) but I don't get why you use it on application/json or application/javascript at all, and I don't know what repercussions this may have on the behaviour of an application.

Could you explain the reason behind this? I would guess something like the following would be enough.

const binaryMimeTypes = [
  'application/octet-stream',
  'image/jpeg',
  'image/png',
  'text/comma-separated-values // unsure if that's binary format
];

Thank you!

@brettstack
Copy link
Collaborator

Excellent question. This is required to work with gzip compression, which the example uses.

@Vadorequest
Copy link
Author

That is what I assumed, you use the compression express package/plugin.

Too bad it is required to manually list all MIME types because if everything is compressed, a simple * would be enough, since everything will be sent as gzip anyway.

@brettstack
Copy link
Collaborator

brettstack commented Mar 9, 2018 via email

@Vadorequest
Copy link
Author

@brettstack I believe this is related to #70

@brettstack
Copy link
Collaborator

Added in #136

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