Sha256: 657cd96308961dc77c9a5be9463fb7261e98be32725c0e3b1a265b75846cbe81

Contents?: true

Size: 993 Bytes

Versions: 12

Compression:

Stored size: 993 Bytes

Contents

(function () {
  /*global describe, it*/

  'use strict';

  var should = require('should'),
    express = require('express'),
    supertest = require('supertest'),
    basicAuth = require('basic-auth-connect'),
    cors = require('../lib');

  var app;

  /* -------------------------------------------------------------------------- */

  app = express();
  app.use(basicAuth('username', 'password'));
  app.use(cors());
  app.post('/', function (req, res) {
    res.send('hello world');
  });

  /* -------------------------------------------------------------------------- */

  describe('basic auth', function () {
    it('POST works', function (done) {
      supertest(app)
        .post('/')
        .auth('username', 'password')
        .expect(200)
        .end(function (err, res) {
          should.not.exist(err);
          res.headers['access-control-allow-origin'].should.eql('*');
          res.text.should.eql('hello world');
          done();
        });
    });
  });

}());

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
blsk-sevcore-0.0.2 blsk_old/bluesky-doc/bluesky-doc/node_modules/cors/test/basic-auth.js
webpack_rails-2.0.1 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-2.0.0 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.3.1 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.3.0 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.2.2 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.2.1 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.2.0 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.1.1 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.1.0 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.0.1 lib/webpack_rails/node_modules/cors/test/basic-auth.js
webpack_rails-1.0.0 lib/webpack_rails/node_modules/cors/test/basic-auth.js