Add security & testing for file uploads

This commit is contained in:
jvyden 2021-10-17 21:07:01 -04:00
parent d1093fdf8f
commit e0d14232d8
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
4 changed files with 92 additions and 2 deletions

View file

@ -47,5 +47,15 @@ namespace ProjectLighthouse.Tests {
return this.Client.SendAsync(requestMessage);
}
public async Task<HttpResponseMessage> UploadFileRequest(string endpoint, string filePath) {
return await this.Client.PostAsync(endpoint, new StringContent(await File.ReadAllTextAsync(filePath)));
}
public async Task<HttpResponseMessage> AuthenticatedUploadFileRequest(string endpoint, string filePath) {
using var requestMessage = new HttpRequestMessage(HttpMethod.Post, endpoint);
requestMessage.Content = new StringContent(await File.ReadAllTextAsync(filePath));
return await this.Client.SendAsync(requestMessage);
}
}
}