mklabs / tiny-lr

tiny livereload

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Middleware sets content-type for non-livereload request

jlowcs opened this issue · comments

The middleware sets the content-type to "application/json" before checking that the request is a livereload request.

https://github.com/mklabs/tiny-lr/blob/v0.1.5/lib/server.js#L118

Because of that, any request that is handled by a middleware after the tiny-lr middleware has a content-type set to "application/json".

The content-type should be set in the function that handles the specific request. Example: https://github.com/mklabs/tiny-lr/blob/v0.1.5/lib/server.js#L194

Hi @jlowcs

Thank you for the initial investigation. As far as I can see, I just have to follow your guidelines. Thanks.

I need however to write a test case on that, just to be sure.

https://github.com/mklabs/tiny-lr/blob/master/test/middleware.js#L46 seems to be the case, I don't understand. Anyway, I'll commit your suggestion. Seems legit.

Should be ok now, thank you @jlowcs