ApiKey Authentication cleanup

This commit is contained in:
Mark McDowall 2013-09-20 15:19:48 -07:00
commit de607e207b
8 changed files with 48 additions and 45 deletions

View file

@ -38,21 +38,7 @@ namespace NzbDrone.Api.Frontend.Mappers
public override Response GetResponse(string resourceUrl)
{
string content;
var response = base.GetResponse(resourceUrl);
var stream = new MemoryStream();
response.Contents.Invoke(stream);
stream.Position = 0;
using (var reader = new StreamReader(stream))
{
content = reader.ReadToEnd();
}
content = content.Replace("API_KEY", _configFileProvider.ApiKey);
response = new StreamResponse(() => StringToStream(content), response.ContentType);
response.Headers["X-UA-Compatible"] = "IE=edge";
return response;
@ -70,6 +56,7 @@ namespace NzbDrone.Api.Frontend.Mappers
text = text.Replace(".css", ".css?v=" + BuildInfo.Version);
text = text.Replace(".js", ".js?v=" + BuildInfo.Version);
text = text.Replace("API_KEY", _configFileProvider.ApiKey);
return text;
}