Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Remove compulsory include_usage when stream=true in gateway #757

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions pkg/plugins/gateway/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,24 +338,6 @@ func (s *Server) HandleRequestBody(ctx context.Context, requestID string, req *e
}

stream, ok = jsonMap["stream"].(bool)
if stream && ok {
streamOptions, ok := jsonMap["stream_options"].(map[string]interface{})
if !ok {
klog.ErrorS(nil, "no stream option available", "requestID", requestID, "jsonMap", jsonMap)
return generateErrorResponse(envoyTypePb.StatusCode_InternalServerError,
[]*configPb.HeaderValueOption{{Header: &configPb.HeaderValue{
Key: HeaderErrorNoStreamOptions, RawValue: []byte("stream options not set")}}},
"no stream option available"), model, targetPodIP, stream, term
}
includeUsage, ok := streamOptions["include_usage"].(bool)
if !includeUsage || !ok {
klog.ErrorS(nil, "no stream with usage option available", "requestID", requestID, "jsonMap", jsonMap)
return generateErrorResponse(envoyTypePb.StatusCode_InternalServerError,
[]*configPb.HeaderValueOption{{Header: &configPb.HeaderValue{
Key: HeaderErrorStreamOptionsIncludeUsage, RawValue: []byte("include usage for stream options not set")}}},
"no stream with usage option available"), model, targetPodIP, stream, term
}
}

headers := []*configPb.HeaderValueOption{}
if routingStrategy == "" {
Expand Down