(ctx context.Context)
| 17 | ) |
| 18 | |
| 19 | func PreAuthRequest(ctx context.Context) { |
| 20 | id := ctx.PathValue("id") |
| 21 | if p, err := preauth.Load(id); err != nil { |
| 22 | err_msg := "err:@preAuth load: " + err.Error() |
| 23 | logger.Error(err_msg) |
| 24 | responder.RespondWithError(ctx, http.StatusInternalServerError, err_msg) |
| 25 | } else { |
| 26 | switch p.Type { |
| 27 | case "download": |
| 28 | streamDownload(ctx, id, p.Nodes, p.Options) |
| 29 | preauth.Delete(id) |
| 30 | default: |
| 31 | responder.RespondWithError(ctx, http.StatusNotFound, "Preauthorization type not supported: "+p.Type) |
| 32 | } |
| 33 | } |
| 34 | return |
| 35 | } |
| 36 | |
| 37 | // handle download and its options |
| 38 | func streamDownload(ctx context.Context, pid string, nodes []string, options map[string]string) { |
nothing calls this directly
no test coverage detected