lazojs / lazo

A client-server web framework built on Node.js that allows front-end developers to easily create a 100% SEO compliant, component MVC structured web application with an optimized first page load.
MIT License
366 stars 48 forks source link

HTTP response data for tunnel requests #292

Open adam-26 opened 9 years ago

adam-26 commented 9 years ago

Similar to #273, allow http response data to be modified for tunnel requests. Refactor the httpResponse to the context, reuse in controller and syncher Refactor the context class to retain server only behavior on the server

The interface is exactly the same as for HTTP response data on controllers, except that the tunnel HTTP response data must be set using a syncher instance:

// within a syncher function
this.setHttpStatusCode(500);
this.getHttpStatusCode();
this.addHttpHeader('allow', 'GET');
this.getHttpHeaders();
this.addHttpVaryParam('accept');
this.getHttpVaryParams();

When these functions are executed as part of an initial page request where the page is rendered on the server, these functions will have no impact on the response. They will only impact the response from a tunnel request.

Currently, there is no application level functionality for adding tunnel response HTTP data. If required, this would not be difficult to implement.

Let me know if you have any questions. Adam.