Skip to content

Commit 8b0318e

Browse files
committed
Merge branch 'fixes/May2017'
2 parents 310081c + bc9f95a commit 8b0318e

File tree

6 files changed

+17
-18
lines changed

6 files changed

+17
-18
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ews-javascript-api",
3-
"version": "0.9.0-dev.6",
3+
"version": "0.9.0-dev.7",
44
"description": "EWS Managed api in JavaScript",
55
"main": "js/ExchangeWebService.js",
66
"scripts": {

src/js/Autodiscover/AutodiscoverService.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ import { Uri } from "../Uri";
3636

3737
import { IXHROptions } from "../Interfaces";
3838
import { Promise } from "../Promise";
39-
import { XHRFactory } from "../XHRFactory";
4039

4140
import { ExchangeServiceBase } from "../Core/ExchangeServiceBase";
4241
export class AutodiscoverService extends ExchangeServiceBase {
@@ -318,7 +317,7 @@ export class AutodiscoverService extends ExchangeServiceBase {
318317
type: "GET",
319318
url: url,
320319
};
321-
return this.GetXHRApi.xhr(xhrOptions)
320+
return this.XHRApi.xhr(xhrOptions)
322321
.then<Uri>((response: XMLHttpRequest) => {
323322
if (response != null) {
324323

@@ -882,7 +881,7 @@ export class AutodiscoverService extends ExchangeServiceBase {
882881

883882

884883
//todo - optimize code, need to apply logic in failed errors as 401 go to onerror of xhr;
885-
return this.GetXHRApi.xhr(xhrOptions)
884+
return this.XHRApi.xhr(xhrOptions)
886885
.then<boolean>((response: XMLHttpRequest) => {
887886
if (response != null) {
888887
var redirectUrl: any = null;;

src/js/Autodiscover/Requests/AutodiscoverRequest.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { ServiceResponse } from "../../Core/Responses/ServiceResponse";
1313
import { ServiceResponseException } from "../../Exceptions/ServiceResponseException";
1414
import { SoapFaultDetails } from "../../Misc/SoapFaultDetails";
1515
import { Uri } from "../../Uri";
16-
import { XHRFactory } from "../../XHRFactory";
1716
import { XmlElementNames } from "../../Core/XmlElementNames";
1817
import { XmlNamespace } from "../../Enumerations/XmlNamespace";
1918

@@ -106,7 +105,7 @@ export class AutodiscoverRequest {
106105
return new Promise((successDelegate, errorDelegate) => {
107106
EwsLogging.DebugLog("sending ews request");
108107
EwsLogging.DebugLog(xhrOptions, true);
109-
this.service.GetXHRApi.xhr(xhrOptions)
108+
this.service.XHRApi.xhr(xhrOptions)
110109
.then((xhrResponse: XMLHttpRequest) => {
111110
var ewsXmlReader = new EwsXmlReader(xhrResponse.responseText || xhrResponse.response);
112111
//EwsLogging.log(util.inspect(xhrResponse.response, { showHidden: false, depth: null, colors: true }));

src/js/Core/ExchangeServiceBase.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Uri } from "../Uri";
2020
import { XHRFactory } from "../XHRFactory";
2121

2222
export class ExchangeServiceBase {
23-
23+
2424
static AccountIsLocked: any /*System.Net.systemnet.HttpStatusCode*/ = 456;
2525

2626
AcceptGzipEncoding: boolean;
@@ -84,8 +84,13 @@ export class ExchangeServiceBase {
8484
private static binarySecret: any;//System.Byte[];
8585
private static defaultUserAgent: string;
8686

87-
public XHRApi: IXHRApi = null;
88-
get GetXHRApi(): IXHRApi { return this.XHRApi || XHRFactory.XHRApi; }
87+
private xhrApi: IXHRApi = null;
88+
get XHRApi(): IXHRApi {
89+
return this.xhrApi || XHRFactory.XHRApi;
90+
}
91+
set XHRApi(xhrApi: IXHRApi) {
92+
this.xhrApi = xhrApi || XHRFactory.XHRApi;
93+
}
8994

9095
constructor();
9196
constructor(timeZone: TimeZoneInfo);

src/js/Core/Requests/HangingServiceRequestBase.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { HangingRequestDisconnectEventArgs } from "./HangingRequestDisconnectEve
77
import { HangingRequestDisconnectReason } from "../../Enumerations/HangingRequestDisconnectReason";
88
import { IXHROptions, IXHRApi, IXHRProgress } from "../../Interfaces";
99
import { Promise } from "../../Promise";
10-
import { XHRFactory } from "../../XHRFactory";
1110

1211
import { ServiceRequestBase } from "./ServiceRequestBase";
1312
/**
@@ -36,7 +35,6 @@ export class HangingServiceRequestBase extends ServiceRequestBase {
3635
// * ews-javascript-api: FetchStream object
3736
// */
3837
// private stream: FetchStream;
39-
private xhrApi: IXHRApi;
4038

4139
/**
4240
* @internal Initializes a new instance of the **HangingServiceRequestBase** class.
@@ -49,7 +47,6 @@ export class HangingServiceRequestBase extends ServiceRequestBase {
4947
super(service);
5048
this.responseHandler = handler;
5149
this.heartbeatFrequencyMilliseconds = heartbeatFrequency;
52-
this.xhrApi = XHRFactory.XHRApi;
5350
}
5451

5552
/**
@@ -65,7 +62,7 @@ export class HangingServiceRequestBase extends ServiceRequestBase {
6562
Disconnect(reason: HangingRequestDisconnectReason, exception: Exception): void;
6663
Disconnect(reason: HangingRequestDisconnectReason = HangingRequestDisconnectReason.UserInitiated, exception: Exception = null): void {
6764
if (this.IsConnected) {
68-
this.xhrApi.disconnect();
65+
this.Service.XHRApi.disconnect();
6966
this.InternalOnDisconnect(reason, exception);
7067
}
7168
}
@@ -373,7 +370,7 @@ export class HangingServiceRequestBase extends ServiceRequestBase {
373370
EwsLogging.DebugLog("sending ews request");
374371
EwsLogging.DebugLog(request, true);
375372

376-
return this.xhrApi.xhrStream(request, progressDelegate);
373+
return this.Service.XHRApi.xhrStream(request, progressDelegate);
377374
// return new Promise((successDelegate, errorDelegate) => {
378375
// this.stream = new FetchStream(this.Service.Url.ToString(), request);
379376

src/js/Core/Requests/ServiceRequestBase.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@ import { EwsUtilities } from "../EwsUtilities";
77
import { ExchangeServerInfo } from "../ExchangeServerInfo";
88
import { ExchangeService } from "../ExchangeService";
99
import { ExchangeVersion } from "../../Enumerations/ExchangeVersion";
10-
import { IXHROptions, IXHRApi } from "../../Interfaces";
10+
import { IXHROptions } from "../../Interfaces";
1111
import { Promise } from "../../Promise"
1212
import { RenderingMode } from "../../Enumerations/RenderingMode";
1313
import { ServiceResponse } from "../Responses/ServiceResponse";
1414
import { ServiceVersionException } from "../../Exceptions/ServiceVersionException";
1515
import { SoapFaultDetails } from "../../Misc/SoapFaultDetails";
1616
import { StringHelper } from "../../ExtensionMethods";
1717
import { Strings } from "../../Strings";
18-
import { XHRFactory } from "../../XHRFactory"
1918
import { XmlAttributeNames } from "../XmlAttributeNames";
2019
import { XmlElementNames } from "../XmlElementNames";
2120
import { XmlNamespace } from "../../Enumerations/XmlNamespace";
@@ -221,7 +220,7 @@ export abstract class ServiceRequestBase {
221220
}
222221
}
223222
//EndGetEwsHttpWebResponse(request: IEwsHttpWebRequest, asyncResult: any /*System.IAsyncResult*/): IEwsHttpWebResponse { throw new Error("Could not implemented."); }
224-
GetEwsHttpWebResponse(request: IXHROptions /*IEwsHttpWebRequest*/): Promise<XMLHttpRequest> { return this.service.GetXHRApi.xhr(request); }
223+
GetEwsHttpWebResponse(request: IXHROptions /*IEwsHttpWebRequest*/): Promise<XMLHttpRequest> { return this.service.XHRApi.xhr(request); }
225224

226225
/**
227226
* Gets string representation of requested server version.
@@ -490,7 +489,7 @@ export abstract class ServiceRequestBase {
490489
EwsLogging.DebugLog("sending ews request");
491490
EwsLogging.DebugLog(request, true);
492491

493-
return this.service.GetXHRApi.xhr(request);
492+
return this.service.XHRApi.xhr(request);
494493

495494
//try
496495
//{

0 commit comments

Comments
 (0)