(requestBytes []byte)
| 160 | } |
| 161 | |
| 162 | func (ss *stdioServer) handleRequest(requestBytes []byte) { |
| 163 | var req jsonRpcRequest |
| 164 | if err := json.Unmarshal(requestBytes, &req); err != nil { |
| 165 | ss.sendError(ID{}, 400, fmt.Sprintf("invalid JSON request: %v", err)) |
| 166 | return |
| 167 | } |
| 168 | // ID is required - check if it was present in the JSON |
| 169 | if !req.ID.IsSet { |
| 170 | ss.sendError(ID{}, 400, "missing request id") |
| 171 | return |
| 172 | } |
| 173 | if req.Method == "" { |
| 174 | ss.sendError(req.ID, 400, "missing method") |
| 175 | return |
| 176 | } |
| 177 | log.Info(). |
| 178 | Str("id", req.ID.String()). |
| 179 | Str("method", req.Method). |
| 180 | Msg("Processing stdio request") |
| 181 | ss.routeRequest(&req) |
| 182 | } |
| 183 | |
| 184 | // routeRequest dispatches the request to the appropriate HTTP handler |
| 185 | // getUserIdParam extracts and validates userId from request params |
no test coverage detected