jshttp / vary Goto Github PK
View Code? Open in Web Editor NEWManipulate the HTTP Vary header
License: MIT License
Manipulate the HTTP Vary header
License: MIT License
there's https://github.com/tellnes/append-header/blob/master/index.js but i dunno.
was looking to implement this in express and koa. realized TJ already thought of this: https://github.com/koajs/koa/blob/master/lib/response.js#L404. an append header module would probably more appropriate since we have to handle cookies and stuff as well.
npm install vary -g
2017-09-25T07_23_50_139Z-debug.log
npm ERR! Unexpected end of input at 1:1906
npm ERR! rtest":"1.1.0"},"directories":{},"dist":{"shasum":"67535ebb694c1d5225
npm ERR! ^
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lhz\AppData\Roaming\npm-cache_logs\2017-09-25T07_23_50_139Z-debug.log
i think defaulting to *
is silly. i'd rather throw. no app should ever do that because it destroys any possibility of caching.
but also, express supports arrays
Since i emitted a lil critic of this module in a blog post i think i have to submit an issue for the problem i raise in it to be totally fair.
I think this module should not assume its users to have any res
object and stay the closest possible to the problem it solves by letting users to define were they want to pick/set the vary header value:
const value = res.getHeader('Vary');
const newValue = vary(value, 'Origin')
res.setHeader('Vary', newValue);
In short, it should be more functionnal ;). I know it is a breaking change and you probably do not plan to do so but just dropping the idea.
For ref.:
https://github.com/nfroidure/blog/blob/4b6bfdccea8ad404dcc2bc116fa609f220388a5c/contents/pages/en/blog/http_rest_apis_with_nodejs.html#L346-L360
Till a draft
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.