Skip to content
This repository was archived by the owner on Oct 13, 2018. It is now read-only.

Added conditional get support for client script middleware #19

Merged

Conversation

maoueh
Copy link
Contributor

@maoueh maoueh commented Jun 9, 2015

The client script is now served conditionally based on the request headers. This means that if the browser sends a conditional request and the current body is fresh, we send a not modified response. Otherwise, we send the request as usual.

Note that I get inspiration from the send package (which in fact I tried to use in my first draft). But most of the stuff we need are in private APIs but we might think about re-using them anyway.

This is complete from my point of view, simply missing your input.

@maoueh maoueh changed the title Added conditional get support for client script middleware WIP Added conditional get support for client script middleware Jun 9, 2015
 * The client script is now served conditionnaly based on the request
   headers. This means that if the browser sends a conditional request
   and the current body is fresh, we send a not modified response. Otherwise,
   we send the request as usual.
@maoueh maoueh force-pushed the feature-cacheable-client-script-serve branch from d26bc2c to 20582f3 Compare June 10, 2015 02:55
@shakyShane
Copy link
Contributor

thanks @maoueh - one more thing while we're on this topic, why not also send a gzipped response?

@maoueh
Copy link
Contributor Author

maoueh commented Jun 12, 2015

I don't have any problem with that. Can I take this as a go :)?

Plan would be to check if browser support it (via the Accept-Encoding header), if yes, we send it gzipped, otherwise send it uncompressed. Sounds good to you?

@maoueh maoueh changed the title WIP Added conditional get support for client script middleware Added conditional get support for client script middleware Jun 12, 2015
@shakyShane
Copy link
Contributor

Yep, perfect


var script = path.resolve(__dirname + "/dist/index.min.js");
var minifiedScript = path.resolve(__dirname + "/dist/index.min.js");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Windows support:

var minifiedScript = path.join(__dirname, "dist/index.min.js");

@shakyShane shakyShane merged commit 20582f3 into BrowserSync:master Jun 17, 2015
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants