Ejemplo n.º 1
0
        public object Any(GetArchive request)
        {
            if (string.IsNullOrEmpty(request.RequestId))
            {
                throw new ArgumentNullException(nameof(request.RequestId));
            }

            var tmpPath = Path.Combine(ProtocConfig.TempDirectory, request.RequestId, "out");

            if (!Directory.Exists(tmpPath))
            {
                throw HttpError.NotFound("Temporary archive no longer exists");
            }

            var tmpZipPath = Path.Combine(ProtocConfig.TempDirectory, request.RequestId, request.FileName ?? "grpc.zip");

            if (!File.Exists(tmpZipPath))
            {
                ZipFile.CreateFromDirectory(tmpPath, tmpZipPath);
            }

            return(new HttpResult(new FileInfo(tmpZipPath), asAttachment: true));
        }
Ejemplo n.º 2
0
 public void SetUp()
 {
     Query  = new GetArchive();
     Prefix = new Uri("https://api.github.com");
 }