mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-17 07:08:01 +08:00
- Replace tidwall/gjson and tidwall/sjson with github.com/MoeForge/moego/ojson and encoding/base64 with github.com/MoeForge/moego/base64 across the main module and examples - Introduce cross-method *ojson.Doc request rewriting pipelines across thinking, signature, client/codex, runtime/executor/helps, pluginhost, and all provider executors with FinalizePayloadDoc as the final semantic barrier - Convert all consecutive JSON mutations (>= 2 Set/SetRaw/Delete operations) to batch edits on ojson.Doc - Upgrade read-only byte paths to ojson.GetBytesNoCopy, ojson.GetManyBytesNoCopy, and util.ParseGJSONBytesNoCopy with explicit strings.Clone ownership protection across streaming and persistent state - Use base64.StdEncoding.ValidateString for zero-allocation signature checks and base64.EncodeDataURL for single-allocation data URL construction
18 lines
619 B
Go
18 lines
619 B
Go
package util
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"github.com/MoeForge/moego/ojson"
|
|
)
|
|
|
|
// IsCodexResponsesLiteRequest recognizes the native header and its websocket metadata mirror.
|
|
func IsCodexResponsesLiteRequest(body []byte, headers http.Header) bool {
|
|
if strings.EqualFold(strings.TrimSpace(headers.Get("X-OpenAI-Internal-Codex-Responses-Lite")), "true") {
|
|
return true
|
|
}
|
|
value := ojson.GetBytesNoCopy(body, "client_metadata.ws_request_header_x_openai_internal_codex_responses_lite")
|
|
return value.Type == ojson.True || value.Type == ojson.String && strings.EqualFold(strings.TrimSpace(value.String()), "true")
|
|
}
|