Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding robots because good websites have them

  • Loading branch information...
commit bc12ba728fea6be15e5dd5c3bbbd43c1ad062ec6 1 parent 6e1b9c3
@AutomatedTester authored
Showing with 15 additions and 0 deletions.
  1. +4 −0 app.js
  2. +11 −0 tests/http_tests.js
View
4 app.js
@@ -142,4 +142,8 @@ app.get('/logout', function(req, res){
});
});
+app.get('/robots.txt', function(req, res){
+ res.send('User-Agent: *', { 'Content-Type': 'text/plain' }, 200);
+});
+
app.listen(3000);
View
11 tests/http_tests.js
@@ -21,6 +21,17 @@ describe('server', function(){
});
});
});
+
+ it('should allow access to /robots.txt', function(done){
+ http.get({ path: '/robots.txt', port: 3000 }, function(res){
+ assert.ok(res.statusCode === 200);
+ var buf = '';
+ res.on('data', function(chunk){buf += chunk});
+ res.on('end', function(){
+ done();
+ });
+ });
+ });
it('Shouldnt Be Able To Post To Root', function(done){
var req = http.request({ path: '/', port: 3000, method: "POST" }, function(res) {
Please sign in to comment.
Something went wrong with that request. Please try again.