Closed tomatau closed 7 years ago
maybe use a koa@2 version koa-static
maybe I am!
"koa-static": "^3.0.0",
:)
PackageJSON diff:
- "koa": "^1.2.4",
- "koa-body": "^1.6.0",
- "koa-compress": "^1.0.9",
- "koa-favicon": "^1.2.1",
- "koa-logger": "~1.3.0",
- "koa-mount": "~1.3.0",
- "koa-router": "^5.4.0",
+ "koa": "^2.0.1",
+ "koa-body": "^2.0.0",
+ "koa-compose": "3",
+ "koa-compress": "^2.0.0",
+ "koa-convert": "^1.2.0",
+ "koa-favicon": "^2.0.0",
+ "koa-logger": "^2.0.1",
+ "koa-mount": "^2.0.0",
+ "koa-router": "7",
"koa-session-store": "^2.0.0",
- "koa-static": "^2.0.0",
- "koa-webpack-dev-middleware": "^1.4.4",
+ "koa-static": "^3.0.0",
+ "koa-webpack-middleware": "^1.0.3",
I'm wrapping koa-session-store in a koa-convert as there isn't a koa2 version
Can you post a minimal example? Most likely, the problem doesn't originate from Koa itself.
I've drilled down to it being a problem with the "koa-webpack-middleware".
https://github.com/leecade/koa-webpack-middleware/blob/master/middleware/hotMiddleware.js#L7-L8
Thanks
I'm building a fairly unusual use-case of a koa app boilerplate and when I try to migrate to koa2, every response is
Content-Type: application/octet-stream
unless I manually overwrite. This includes responses serving static assets! Most responses arectx.response.body = "<html>some string</html>"
and a few are plain JSON.NB: My app boilerplate is for a "universal/isomorphic" React boilerplate that abuses babel-runtime compilation and the node require.cache to get live updates to the server code. There's also some funky business with injecting routes and assets at runtime to improve testability. None of these factors affected the auto Content-Type in Koa1 so I've no idea why it would stop working for Koa2?