Skip to content

Commit

Permalink
Make status a query parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
omiranda committed Sep 26, 2023
1 parent a9dea00 commit 91f8be2
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions go/internal/feast/server/http_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net/http"
"os"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -136,7 +137,6 @@ type getOnlineFeaturesRequest struct {
Entities map[string]repeatedValue `json:"entities"`
FullFeatureNames bool `json:"full_feature_names"`
RequestContext map[string]repeatedValue `json:"request_context"`
Status bool `json:"status"`
}

func NewHttpServer(fs *feast.FeatureStore, loggingService *logging.LoggingService) *httpServer {
Expand All @@ -149,6 +149,17 @@ func (s *httpServer) getOnlineFeatures(w http.ResponseWriter, r *http.Request) {
return
}

statusQuery := r.URL.Query().Get("status")
status := false
if statusQuery != "" {
var err error
status, err = strconv.ParseBool(statusQuery)
if err != nil {
http.Error(w, fmt.Sprintf("Error parsing status query parameter: %+v", err), http.StatusBadRequest)
return
}
}

decoder := json.NewDecoder(r.Body)
var request getOnlineFeaturesRequest
err := decoder.Decode(&request)
Expand Down Expand Up @@ -191,7 +202,7 @@ func (s *httpServer) getOnlineFeatures(w http.ResponseWriter, r *http.Request) {
for _, vector := range featureVectors {
featureNames = append(featureNames, vector.Name)
result := make(map[string]interface{})
if request.Status {
if status {
var statuses []string
for _, status := range vector.Statuses {
statuses = append(statuses, status.String())
Expand Down

0 comments on commit 91f8be2

Please sign in to comment.