diff --git a/UI/Component/Tab.js b/UI/Component/Tab.js index f3134f4..e8fb28f 100644 --- a/UI/Component/Tab.js +++ b/UI/Component/Tab.js @@ -1,4 +1,4 @@ -import { Http } from '../../Uri/Http.js'; +import { Http } from '../../Uri/HttpUri.js'; import { UriFactory } from '../../Uri/UriFactory.js'; /** @@ -65,7 +65,7 @@ export class Tab for (let i = 0; i < length; ++i) { nodes[i].addEventListener('click', function (evt) { - let fragmentString = window.location.href.includes('#') ? Http.parseUrl(window.location.href).fragment : ''; + let fragmentString = window.location.href.includes('#') ? HttpUri.parseUrl(window.location.href).fragment : ''; /* Change Tab */ /* Remove selected tab */ @@ -121,7 +121,7 @@ export class Tab */ activateTabUri(e) { - const fragmentString = window.location.href.includes('#') ? Http.parseUrl(window.location.href).fragment : ''; + const fragmentString = window.location.href.includes('#') ? HttpUri.parseUrl(window.location.href).fragment : ''; const fragments = fragmentString.split(','), fragLength = fragments.length; diff --git a/Uri/Http.js b/Uri/HttpUri.js similarity index 97% rename from Uri/Http.js rename to Uri/HttpUri.js index 56542c8..ca64b9a 100644 --- a/Uri/Http.js +++ b/Uri/HttpUri.js @@ -8,7 +8,7 @@ * @version 1.0.0 * @since 1.0.0 */ -export class Http +export class HttpUri { /** * @constructor @@ -149,7 +149,7 @@ export class Http { this.uri = uri; - const parsed = Http.parseUrl(this.uri, 'php'); + const parsed = HttpUri.parseUrl(this.uri, 'php'); this.scheme = parsed['scheme']; this.host = parsed['host']; @@ -165,7 +165,7 @@ export class Http this.queryString = typeof parsed['query'] !== 'undefined' ? parsed['query'] : []; if (this.queryString !== null) { - this.query = Http.getAllUriQueryParameters(this.queryString); + this.query =HttpUri.getAllUriQueryParameters(this.queryString); } this.fragment = typeof parsed['fragment'] !== 'undefined' ? parsed['fragment'] : ''; diff --git a/Uri/UriFactory.js b/Uri/UriFactory.js index 2e79fc6..f69e88a 100644 --- a/Uri/UriFactory.js +++ b/Uri/UriFactory.js @@ -1,4 +1,4 @@ -import { Http } from './Http.js'; +import { HttpUri } from './HttpUri.js'; import { FormView } from './../Views//FormView.js'; /** @@ -178,7 +178,7 @@ export class UriFactory */ static build (uri, toMatch) { - const current = Http.parseUrl(window.location.href); + const current = HttpUri.parseUrl(window.location.href); let parsed = uri.replace(new RegExp('\{[\/#\?%@\.\$][a-zA-Z0-9\-]*\}', 'g'), function (match) { match = match.substr(1, match.length - 2); @@ -207,7 +207,7 @@ export class UriFactory return ''; } else if (match.indexOf('?') === 0) { - return Http.getUriQueryParameter(current.query, match.substr(1)); + returnHttpUri.getUriQueryParameter(current.query, match.substr(1)); } else if (match.indexOf('/') === 0) { return 'ERROR PATH'; } else if (match === '%') { diff --git a/tests/Uri/HttpTest.js b/tests/Uri/HttpUriTest.js similarity index 70% rename from tests/Uri/HttpTest.js rename to tests/Uri/HttpUriTest.js index 0bd8cad..d8b557b 100644 --- a/tests/Uri/HttpTest.js +++ b/tests/Uri/HttpUriTest.js @@ -1,4 +1,4 @@ -import { Http } from '../../Uri/Http.js'; +import { HttpUri } from '../../Uri/HttpUri.js'; describe('HttpTest', function () { @@ -8,7 +8,7 @@ describe('HttpTest', function () { it('Testing php parsing mode', function () { - let parsed = Http.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'php'); + let parsed = HttpUri.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'php'); expect(parsed.scheme).toBe('http'); expect(parsed.user).toBe('username'); @@ -22,7 +22,7 @@ describe('HttpTest', function () it('Testing strict parsing mode', function () { - let parsed = Http.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'strict'); + let parsed = HttpUri.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'strict'); expect(parsed.scheme).toBe('http'); expect(parsed.user).toBe('username'); @@ -36,7 +36,7 @@ describe('HttpTest', function () it('Testing loose parsing mode', function () { - let parsed = Http.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'loose'); + let parsed = HttpUri.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'loose'); expect(parsed.scheme).toBe('http'); expect(parsed.user).toBe('username'); @@ -52,7 +52,7 @@ describe('HttpTest', function () { let thrown = function () { - Http.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'invalid'); + HttpUri.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'invalid'); }; expect(thrown).toThrowError(Error, 'Unexpected parsing mode.'); }); @@ -62,12 +62,12 @@ describe('HttpTest', function () { it('Testing query extraction', function () { - let parsed = Http.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'php'); - let query = Http.getUriQueryParameter(parsed.query, 'test'); + let parsed = HttpUri.parseUrl('http://username:password@example.com:8080/test/path?test=123&two=ha#frag', 'php'); + let query =HttpUri.getUriQueryParameter(parsed.query, 'test'); expect(query).toBe('123'); - query = Http.getUriQueryParameter(parsed.query, 'two'); + query =HttpUri.getUriQueryParameter(parsed.query, 'two'); expect(query).toBe('ha'); }); });