mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-13 02:28:10 +00:00
Better errors from Download: Make GetFileSasUrl nullable (#3229)
This allows us to generate 404s when someone attempts to download from a non-existent container. At the moment we generate a 500 which isn't useful, or very good looks-wise.
This commit is contained in:
@ -55,6 +55,22 @@ public abstract class DownloadTestBase : FunctionTestBase {
|
||||
Assert.Equal(ErrorCode.INVALID_REQUEST.ToString(), err.Title);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Async.Task Container_NotFound_Generates404() {
|
||||
var req = TestHttpRequestData.Empty("GET");
|
||||
// this container won't exist because we haven't explicitly created it
|
||||
var url = new UriBuilder(req.Url) { Query = "container=xxx&filename=yyy" }.Uri;
|
||||
req.SetUrl(url);
|
||||
|
||||
var func = new Download(Context);
|
||||
|
||||
var result = await func.Run(req);
|
||||
Assert.Equal(HttpStatusCode.NotFound, result.StatusCode);
|
||||
|
||||
var err = BodyAs<ProblemDetails>(result);
|
||||
Assert.Equal(ErrorCode.INVALID_CONTAINER.ToString(), err.Title);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Async.Task Download_RedirectsToResult_WithLocationHeader() {
|
||||
// set up a file to download
|
||||
|
Reference in New Issue
Block a user