mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-11 01:48:40 +00:00
rename http to httpuri
This commit is contained in:
parent
32856280b4
commit
af5ed7225d
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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'] : '';
|
||||
|
|
@ -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 === '%') {
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user