- improve docu for "setHeader" method

- add test case for "setHeader" call with port number
This commit is contained in:
Sefa Ilkimen
2017-10-27 12:16:01 +02:00
parent 208529003d
commit 0d8d7735d9
3 changed files with 152 additions and 86 deletions
+20 -1
View File
@@ -58,7 +58,7 @@ describe('Advanced HTTP www interface', function() {
http.get('url', {}, {}, noop, noop);
});
it('resolves host headers correctly', () => {
it('resolves host headers correctly (set without port number)', () => {
mock(`${PLUGIN_ID}.cookie-handler`, {
getCookieString: () => 'fakeCookieString'
});
@@ -77,6 +77,25 @@ describe('Advanced HTTP www interface', function() {
http.get('https://www.google.de/?gws_rd=ssl', {}, {}, noop, noop);
});
it('resolves host headers correctly (set with port number)', () => {
mock(`${PLUGIN_ID}.cookie-handler`, {
getCookieString: () => 'fakeCookieString'
});
mock('cordova/exec', (onSuccess, onFail, namespace, method, params) => {
const headers = params[2];
headers.should.eql({
Cookie: 'fakeCookieString',
myKey: 'myValue'
});
});
loadHttp();
http.setHeader('www.google.de:8080', 'myKey', 'myValue');
http.get('https://www.google.de:8080/?gws_rd=ssl', {}, {}, noop, noop);
});
it('resolves request headers correctly', () => {
mock(`${PLUGIN_ID}.cookie-handler`, {
getCookieString: () => 'fakeCookieString'