Skip to content

Add support for HTTP QUERY method#309

Open
seanpdoyle wants to merge 1 commit into
ruby:masterfrom
seanpdoyle:ref-rfc10008-query
Open

Add support for HTTP QUERY method#309
seanpdoyle wants to merge 1 commit into
ruby:masterfrom
seanpdoyle:ref-rfc10008-query

Conversation

@seanpdoyle

Copy link
Copy Markdown

As of June 2026, RFC 10008 is a proposed standard.

From the RFC Abstract:

This specification defines the QUERY method for HTTP. A QUERY requests
that the request target process the enclosed content in a safe and
idempotent manner and then respond with the result of that processing.
This is similar to POST requests, but QUERY requests can be
automatically repeated or restarted without concern for partial state
changes.

This commit proposes support for the HTTP Query method by way of the Net::HTTP::Query class along with the corresponding #query and #request_query methods.

@rhenium rhenium 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.

Could you add it to IDEMPOTENT_METHODS_ so that requests can be retried?

Class-level rdoc comments mention request method-specific methods. They should also updated to include the new methods for QUERY.

Comment thread lib/net/http/requests.rb Outdated
Comment thread lib/net/http.rb Outdated
Comment thread test/net/http/test_http.rb Outdated
Comment thread lib/net/http.rb Outdated
#
# #<Net::HTTPOK 200 OK readbody=false>
#
def request_query(path, body, initheader = nil, &block) #:nodoc:

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.

Does anyone know why request_put is undocumented (marked as :nodoc:)? This appears to have been added in a 2003 commit, but I couldn't find the context: 38840ac

We also don't have request_patch or request_delete corresponding to PATCH and DELETE methods.

Are request_<method> methods considered obsolete?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I wonder if put should have also taken a block, but that would be out of scope of this PR.

Could they all be included in the diff, or would it be best to open two separate PRs:

  1. to remove the :nodoc: for #request_put and to add support for passing a block to #put
  2. to introduce request_patch and request_delete

I'm happy to open a separate PR to make these changes based on the response to request_-prefixed methods being deprecated.

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.

Changes to methods unrelated to the QUERY method should be in separate PRs.

Regarding those request_<method> methods, it's unclear to me if they're deprecated and we should avoid adding new ones, or if this was an oversight and methods for PATCH, DELETE, etc. are just missing. Personally I've never used them and they seem redundant, so I suspect it's the former, but I'm not sure.

I've requested a review from @nurse (the maintainer of net/http).

@rhenium

rhenium commented Jul 6, 2026

Copy link
Copy Markdown
Member

This will close #202

@rhenium rhenium linked an issue Jul 6, 2026 that may be closed by this pull request
@seanpdoyle seanpdoyle force-pushed the ref-rfc10008-query branch from 38108cd to 0dc82a9 Compare July 6, 2026 16:51
Closes ruby#202

As of June 2026, [RFC 10008][] is a proposed standard.

From the RFC Abstract:

> This specification defines the QUERY method for HTTP. A QUERY requests
> that the request target process the enclosed content in a safe and
> idempotent manner and then respond with the result of that processing.
> This is similar to POST requests, but QUERY requests can be
> automatically repeated or restarted without concern for partial state
> changes.

This commit proposes support for the HTTP Query method by way of the
`Net::HTTP::Query` class along with the corresponding `#query` and
`#request_query` methods.

[RFC 10008]: https://www.rfc-editor.org/rfc/rfc10008.html
@seanpdoyle seanpdoyle force-pushed the ref-rfc10008-query branch from 0dc82a9 to 76b11b3 Compare July 6, 2026 17:07

@rhenium rhenium 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.

Changes look good to me, apart from the open question about request_query.

@rhenium rhenium requested a review from nurse July 6, 2026 18:31
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.

Please add support for the QUERY HTTP method

2 participants