mirror of
https://github.com/donl/slouch.git
synced 2026-05-25 22:07:24 -06:00
* Pass slouch in when instantiating EnhancedRequest This is to allow EnhanceRequest to access slouch._requestWrapper.setCookie * Update locally stored cookie when response has set-cookie header * Delete unused this._cookie * Fix cookie-authentication in browser * Fix test Request header now always include withCredentials: true * Fix test EnhancedRequest constructor now requires instance of Slouch * Typo * Fix test * Remove TODO comment and clean up redundant code * Revert change to user.js * Fix user test spec * Fix user test spec * Fix browser coverage test fail * FIx beautify test fail * Fix failed jshint test
36 lines
851 B
JavaScript
36 lines
851 B
JavaScript
'use strict';
|
|
|
|
var RequestWrapper = require('../../scripts/request-wrapper');
|
|
|
|
describe('request-wrapper', function () {
|
|
|
|
it('should not replace existing headers', function () {
|
|
var requestWrapper = new RequestWrapper();
|
|
requestWrapper.setCookie('my-cookie');
|
|
var opts = requestWrapper._setCookieHeader({
|
|
headers: {
|
|
'my-header': 'my-value'
|
|
}
|
|
});
|
|
opts.should.eql({
|
|
headers: {
|
|
'my-header': 'my-value',
|
|
cookie: 'my-cookie'
|
|
},
|
|
withCredentials: true
|
|
});
|
|
});
|
|
|
|
it('should set cookie in header', function () {
|
|
var requestWrapper = new RequestWrapper();
|
|
requestWrapper.setCookie('my-cookie');
|
|
var opts = requestWrapper._setCookieHeader({});
|
|
opts.should.eql({
|
|
headers: {
|
|
cookie: 'my-cookie'
|
|
},
|
|
withCredentials: true
|
|
});
|
|
});
|
|
|
|
});
|