Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
johntron committed Nov 21, 2013
0 parents commit cb6e0a6
Show file tree
Hide file tree
Showing 6 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
components
build
Empty file added History.md
Empty file.
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

build: components index.js
@component build --dev

components: component.json
@component install --dev

clean:
rm -fr build components template.js

.PHONY: clean
29 changes: 29 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

# no-cache

Plugin for visionmedia/superagent that adds headers to all requests that prevents
caching

*Note:* Until TJ merges [my pull request](https://github.com/visionmedia/superagent/pull/293) adding plugin support, you'll have to
use johntron/supermedia

## Installation

Install with [component(1)](http://component.io):

$ component install johntron/no-cache

## API

var request = require('request'),
no_cache = require('no-cache');
request.get('/url')
.use(no_cache)
.end(function () {
// do something
});

## License

MIT
14 changes: 14 additions & 0 deletions component.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "no-cache",
"repo": "johntron/no-cache",
"description": "Plugin for visionmedia/superagent that adds headers to all requests that prevents caching",
"version": "0.0.1",
"keywords": [],
"dependencies": {},
"development": {},
"license": "MIT",
"main": "index.js",
"scripts": [
"index.js"
]
}
7 changes: 7 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = function(request) {
request.headers = {
'X-Requested-With': 'XMLHttpRequest',
'Cache-Control': 'no-cache'
};
return request;
}

0 comments on commit cb6e0a6

Please sign in to comment.