StoreArtifactInfo stores the Base Artifact Info for any package type.
( provider pkg.ArtifactInfoProvider, )
| 24 | |
| 25 | // StoreArtifactInfo stores the Base Artifact Info for any package type. |
| 26 | func StoreArtifactInfo( |
| 27 | provider pkg.ArtifactInfoProvider, |
| 28 | ) func(next http.Handler) http.Handler { |
| 29 | return func(next http.Handler) http.Handler { |
| 30 | return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { |
| 31 | packageInfo, err := provider.GetPackageArtifactInfo(r) |
| 32 | if err != nil { |
| 33 | render.TranslatedUserError(r.Context(), w, err) |
| 34 | return |
| 35 | } |
| 36 | // Store the base artifact info in the context |
| 37 | ctx := request.WithArtifactInfo(r.Context(), packageInfo) |
| 38 | next.ServeHTTP(w, r.WithContext(ctx)) |
| 39 | }) |
| 40 | } |
| 41 | } |
no test coverage detected
searching dependent graphs…