Skip to content

Step13: adding requestid middleware and the analyzer endpoint#14

Merged
Parth576 merged 3 commits into
mainfrom
step13
Feb 26, 2026
Merged

Step13: adding requestid middleware and the analyzer endpoint#14
Parth576 merged 3 commits into
mainfrom
step13

Conversation

@Parth576
Copy link
Copy Markdown
Owner

No description provided.

Add RequestIDMiddleware that generates UUID v4 (or propagates incoming
X-Request-ID header), injects the ID into the request context, and sets
it on the response header. Add TimeoutMiddleware that wraps the request
context with a configurable deadline (default 60s) using context.WithTimeout.

Update LoggingMiddleware to include request_id in log output when present
in context. Wire both middleware into the router chain in order:
CORS -> Request ID -> Timeout -> Logging -> routes.

Assisted by the code-assist SOP
… check

Add POST /api/v1/analyze endpoint that validates JSON input (url, html
fields), invokes the analysis pipeline, and maps errors to appropriate
HTTP status codes (400 validation, 504 timeout, 502 upstream failure).

Introduce PipelineRunner interface for testability, allowing the handler
to be tested with a mock analyzer without constructing the full
dependency chain.

Update NewHealthHandler to accept an optional Qdrant health check
function that reports 'connected' or 'unavailable' status, falling back
to showing the configured URL when no check is provided.

Update NewRouter signature to accept pipeline and qdrant check
dependencies, register the new analyze route, and update main.go
accordingly (passing nil for now until full pipeline wiring).

Assisted by the code-assist SOP
Comment thread backend/internal/api/middleware.go
@Parth576 Parth576 merged commit 0f3a19f into main Feb 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant