public void AddToHeaders(HttpRequestHeaders headers) { Guard.NotNull(headers, nameof(headers)); if (IsFlatten) { headers.TryAddWithoutValidation("X-Flatten", "true"); } if (IsUnpublished) { headers.TryAddWithoutValidation("X-Unpublished", "true"); } if (Languages != null) { var languages = string.Join(", ", Languages.Where(x => !string.IsNullOrWhiteSpace(x))); if (!string.IsNullOrWhiteSpace(languages)) { headers.TryAddWithoutValidation("X-Languages", languages); } } if (AssetUrlsToResolve != null) { var assetFields = string.Join(", ", AssetUrlsToResolve.Where(x => !string.IsNullOrWhiteSpace(x))); if (!string.IsNullOrWhiteSpace(assetFields)) { headers.TryAddWithoutValidation("X-AssetFields", assetFields); } } }
internal void AddToHeaders(HttpRequestHeaders headers) { Guard.NotNull(headers, nameof(headers)); if (IsFlatten) { headers.TryAddWithoutValidation("X-Flatten", "true"); } if (IsUnpublished) { headers.TryAddWithoutValidation("X-Unpublished", "true"); } if (IsNotQueryingTotal) { headers.TryAddWithoutValidation("X-NoTotal", "true"); } if (IsNotQueryingSlowTotal) { headers.TryAddWithoutValidation("X-NoSlowTotal", "true"); } if (Languages != null) { var languages = string.Join(", ", Languages.Where(x => !string.IsNullOrWhiteSpace(x))); if (!string.IsNullOrWhiteSpace(languages)) { headers.TryAddWithoutValidation("X-Languages", languages); } } if (AssetUrlsToResolve != null) { var assetFields = string.Join(", ", AssetUrlsToResolve.Where(x => !string.IsNullOrWhiteSpace(x))); if (!string.IsNullOrWhiteSpace(assetFields)) { headers.TryAddWithoutValidation("X-Resolve-Urls", assetFields); } } if (IsIgnoreFallback) { headers.TryAddWithoutValidation("X-NoResolveLanguages", "1"); } }