mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-14 13:52:28 +00:00
Add security & testing for file uploads
This commit is contained in:
parent
d1093fdf8f
commit
e0d14232d8
4 changed files with 92 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue