Files
astra-api-gateway/services/store/store.go
2023-06-30 17:13:46 +03:00

24 lines
492 B
Go

package store
import (
"astra-api-gateway/config"
"astra-api-gateway/pkg/api"
"github.com/labstack/echo/v4"
"net/http"
"strings"
)
func GetFileFromStore(c echo.Context) error {
fileName := strings.ReplaceAll(c.Request().RequestURI, "/store", "")
data, err, req := api.GetRequest(
config.Env.MSHosts.StoreHost+fileName,
c.Request().Header,
)
if err != nil {
return c.NoContent(http.StatusBadGateway)
}
return c.Blob(req.StatusCode, req.Header.Get("Content-Type"), data)
}