Skip to content

Commit fbacccf

Browse files
committed
Cover QUERY method helper
1 parent ed5aad7 commit fbacccf

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

‎readme.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ Please see the [project documentation](https://socketry.github.io/protocol-http/
3030

3131
Please see the [project releases](https://socketry.github.io/protocol-http/releases/index) for all releases.
3232

33+
### Unreleased
34+
35+
- Add support for the HTTP `QUERY` method.
36+
3337
### v0.62.1
3438

3539
- Fix handling of `Stream#read(0)`, it must return a mutable string (or clear the given buffer).

‎test/protocol/http/methods.rb‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Copyright, 2019-2025, by Samuel Williams.
55

66
require "protocol/http/methods"
7+
require "protocol/http/request"
78

89
ValidMethod = Sus::Shared("valid method") do |name|
910
it "defines #{name} method" do
@@ -39,6 +40,23 @@
3940
expect(subject.constants.length).to be == 10
4041
end
4142

43+
it "defines QUERY helper method" do
44+
middleware = Class.new(subject) do
45+
attr :request
46+
47+
def call(request)
48+
@request = request
49+
end
50+
end.new
51+
52+
middleware.query("/search", body: "term=ruby")
53+
54+
expect(middleware.request).to have_attributes(
55+
method: be == "QUERY",
56+
path: be == "/search",
57+
)
58+
end
59+
4260
with ".valid?" do
4361
with "FOOBAR" do
4462
it "is not a valid method" do

0 commit comments

Comments
 (0)