Skip to content

Add support for the HTTP QUERY verb (RFC 10008) - #740

Open
Ricardo Boss (ricardoboss) wants to merge 1 commit into
microsoft:mainfrom
ricardoboss:issues/8126-query-verb
Open

Ricardo Boss (ricardoboss) wants to merge 1 commit into
microsoft:mainfrom
ricardoboss:issues/8126-query-verb

Conversation

@ricardoboss

Copy link
Copy Markdown

Overview

This adds support for the relatively new HTTP verb QUERY, which allows sending a request body (like POST) while being able to be cached (unlike POST`).

Related Issue

Relates to microsoft/kiota#8126

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The new QUERY retry behavior lacks a regression test that exercises an actual QUERY request.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds HTTP QUERY support to Kiota’s Python abstractions and HTTPX retry middleware.

Changes:

  • Adds Method.QUERY.
  • Allows QUERY requests in the default retryable methods.
  • Updates retry-handler expectations.
File summaries
File Description
packages/abstractions/kiota_abstractions/method.py Defines the QUERY method.
packages/http/httpx/kiota_http/middleware/retry_handler.py Enables retries for QUERY.
packages/http/httpx/tests/middleware_tests/test_retry_handler.py Updates allowed-method expectations.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/http/httpx/tests/middleware_tests/test_retry_handler.py
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Redirect handling and retry-path regression coverage remain unresolved.

Review details

Suppressed comments (2)

packages/abstractions/kiota_abstractions/method.py:25

  • Adding Method.QUERY exposes this request type through the default HTTPX middleware, but RedirectHandler still changes every non-HEAD request to GET for a 302 (packages/http/httpx/kiota_http/middleware/redirect_handler.py:171-174). RFC 10008 requires a QUERY's method and body to be preserved for 302 redirects, so a redirected QUERY is silently downgraded and its body is discarded; update redirect handling and add a regression test before treating QUERY as fully supported.
    # The HTTP QUERY method
    QUERY = "QUERY"

packages/http/httpx/tests/middleware_tests/test_retry_handler.py:27

  • The new assertion only checks that the default set contains the string QUERY; it does not exercise the retry path with an actual httpx.Request("QUERY", ...). Add a regression test alongside test_retries_valid so a future method-specific check cannot make QUERY appear in the constant while still skipping its retry.
        ['HEAD', 'GET', 'PUT', 'POST', 'PATCH', 'DELETE', 'OPTIONS', 'QUERY']
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@baywet Vincent Biret (baywet) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the changes!

@baywet

Copy link
Copy Markdown
Member

Actually Ricardo Boss (@ricardoboss) re-reading the bot's comments, and the RFC, I think it's correct for the redirect handler, would you mind looking into this please? And we'll probably need to replicate the change across languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress 🚧

Development

Successfully merging this pull request may close these issues.

3 participants