зеркало из https://github.com/Azure/ms-rest-js.git
Make OperationSpec.baseUrl an optional property for moving OperationSpecs into module/file scope
This commit is contained in:
Родитель
5547c64b45
Коммит
d422cf7e63
|
@ -22,9 +22,10 @@ export interface OperationSpec {
|
|||
|
||||
/**
|
||||
* The URL that was provided in the service's specification. This will still have all of the URL
|
||||
* template variables in it.
|
||||
* template variables in it. If this is not provided when the OperationSpec is created, then it
|
||||
* will be populated by a "baseUri" property on the ServiceClient.
|
||||
*/
|
||||
baseUrl: string;
|
||||
baseUrl?: string;
|
||||
|
||||
/**
|
||||
* The fixed path for this operation's URL. This will still have all of the URL template variables
|
||||
|
|
|
@ -177,6 +177,13 @@ export class ServiceClient {
|
|||
|
||||
let result: Promise<HttpOperationResponse>;
|
||||
try {
|
||||
if (operationSpec.baseUrl == undefined) {
|
||||
operationSpec.baseUrl = (this as any).baseUri;
|
||||
if (!operationSpec.baseUrl) {
|
||||
throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.");
|
||||
}
|
||||
}
|
||||
|
||||
httpRequest.method = operationSpec.httpMethod;
|
||||
httpRequest.operationSpec = operationSpec;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче