feat: Send API key via header instead of query param

pull/201/head
Robert Dailey 1 year ago
parent 5fc4da0f52
commit 761a247860

@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Changed
- API Key is now sent via the `X-Api-Key` header instead of the `apikey` query parameter. This
lessens the need to redact information in the console.
## [4.4.1] - 2023-04-08
### Fixed

@ -55,13 +55,8 @@ public static class FlurlLogging
public static Url SanitizeUrl(Url url)
{
// Replace hostname and API key for user privacy
// Replace hostname for user privacy
url.Host = "REDACTED";
if (url.QueryParams.Contains("apikey"))
{
url.QueryParams.AddOrReplace("apikey", "REDACTED");
}
return url;
}
}

@ -16,6 +16,6 @@ public class ServiceRequestBuilder : IServiceRequestBuilder
{
var client = _clientFactory.BuildClient(config.BaseUrl);
return client.Request(new[] {"api", "v3"}.Concat(path).ToArray())
.SetQueryParams(new {apikey = config.ApiKey});
.WithHeader("X-Api-Key", config.ApiKey);
}
}

Loading…
Cancel
Save