Skip to content

Commit

Permalink
[v6] Use host default value (#676)
Browse files Browse the repository at this point in the history
* Use host default value

* Check for $host defaultValue
  • Loading branch information
joheredi authored Jun 25, 2020
1 parent be1412d commit 6e81da3
Show file tree
Hide file tree
Showing 49 changed files with 50 additions and 50 deletions.
4 changes: 2 additions & 2 deletions src/transforms/urlTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export async function transformBaseUrl(
let isCustom = false;

const $host = (codeModel.globalParameters || []).find(p => {
const { serializedName } = getLanguageMetadata(p.language);
serializedName === "$host";
const { name } = getLanguageMetadata(p.language);
return name === "$host" && Boolean(p.clientDefaultValue);
});

if (!$host) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class AdditionalPropertiesClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class AzureParameterGroupingClientContext extends coreHttp.ServiceClient

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ReportClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AzureSpecialPropertiesClientContext extends coreHttp.ServiceClient

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyArrayClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyBooleanClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyBooleanQuirksClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyByteClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class BodyComplexClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyDateClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyDateTimeClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyDateTimeRfc1123ClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyDictionaryClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyDurationClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyFileClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyIntegerClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyNumberClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyStringClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class BodyTimeClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class HeaderClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class HttpInfrastructureClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/generated/lro/src/lROClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class LROClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class MediaTypesClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ModelFlatteningClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class MultipleInheritanceClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class PagingClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class ReportClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
2 changes: 1 addition & 1 deletion test/integration/generated/url/src/urlClientContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class UrlClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Parameter assignments
this.globalStringPath = globalStringPath;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class XmlServiceClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "http://localhost:3000";

// Assigning values to Constant parameters
this.$host = options.$host || "http://localhost:3000";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class ADHybridHealthServiceContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class DeploymentScriptsClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class FeatureClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class ManagementLinkClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class ManagementLockClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ApplicationClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class PolicyClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ResourceManagementClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class SubscriptionClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Assigning values to Constant parameters
this.$host = options.$host || "https://management.azure.com";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class ComputeManagementClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class CosmosDBManagementClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class GraphRbacManagementClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://graph.windows.net";

// Parameter assignments
this.tenantID = tenantID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class KeyVaultManagementClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://management.azure.com";

// Parameter assignments
this.subscriptionId = subscriptionId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MonitorClientContext extends coreHttp.ServiceClient {

this.requestContentType = "application/json; charset=utf-8";

this.baseUri = options.endpoint || "{$host}";
this.baseUri = options.endpoint || "https://monitoring.azure.com";

// Assigning values to Constant parameters
this.$host = options.$host || "https://monitoring.azure.com";
Expand Down
Loading

0 comments on commit 6e81da3

Please sign in to comment.