Fixed unit test

This commit is contained in:
mauriziovitale84
2016-06-21 15:20:35 +01:00
parent 75a533bcde
commit 98d6b5405f
3 changed files with 60 additions and 34 deletions

View File

@@ -33,7 +33,6 @@ declare let AlfrescoApi: any;
*/
@Injectable()
export class UploadService {
private _baseUrlPath: string = '/alfresco/api/-default-/public/alfresco/versions/1';
private _url: string = '/alfresco/service/api/upload';
private _method: string = 'POST';
@@ -66,7 +65,6 @@ export class UploadService {
*/
public setOptions(options: any): void {
this._url = options.url || this._url;
this._baseUrlPath = options.baseUrlPath || this._baseUrlPath;
this._formFields = options.formFields != null ? options.formFields : this._formFields;
}
@@ -86,14 +84,6 @@ export class UploadService {
return this._url;
}
/**
* Get the base url
* @returns {string}
*/
public getBaseUrl(): string {
return this._baseUrlPath;
}
/**
* Get the form fields
* @returns {Object}
@@ -224,7 +214,7 @@ export class UploadService {
let xmlHttpRequest = this.createXMLHttpRequestInstance(uploadingFileModel, elementEmit);
uploadingFileModel._xmlHttpRequest = xmlHttpRequest;
xmlHttpRequest.open(this._method, this.getHost() + this._url, true);
xmlHttpRequest.open(this._method, this.getHost() + this.getUrl(), true);
let authToken = btoa(basicAuth.username + ':' + basicAuth.password);
if (authToken) {
xmlHttpRequest.setRequestHeader('Authorization', `${basicAuth.type} ${authToken}`);