Skip to content

Commit 2b15bd6

Browse files
committed
fix: Resolve doctest failures in Response.new/1
- Change doctests from struct pattern matching to field access - Avoids partial struct matching issues with all required fields - All response_test.exs doctests now pass (12 doctests, 0 failures)
1 parent cf9cb8f commit 2b15bd6

File tree

1 file changed

+19
-18
lines changed

1 file changed

+19
-18
lines changed

lib/http/response.ex

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -158,24 +158,25 @@ defmodule HTTP.Response do
158158
159159
## Examples
160160
161-
iex> HTTP.Response.new(status: 200, body: "OK", url: URI.parse("https://example.com"))
162-
%HTTP.Response{
163-
status: 200,
164-
status_text: "OK",
165-
ok: true,
166-
body: "OK",
167-
body_used: false,
168-
redirected: false,
169-
type: :basic
170-
}
171-
172-
iex> HTTP.Response.new(status: 404, headers: HTTP.Headers.new())
173-
%HTTP.Response{
174-
status: 404,
175-
status_text: "Not Found",
176-
ok: false,
177-
body_used: false
178-
}
161+
iex> response = HTTP.Response.new(status: 200, body: "OK", url: URI.parse("https://example.com"))
162+
iex> response.status
163+
200
164+
iex> response.status_text
165+
"OK"
166+
iex> response.ok
167+
true
168+
iex> response.body
169+
"OK"
170+
iex> response.body_used
171+
false
172+
173+
iex> response = HTTP.Response.new(status: 404, headers: HTTP.Headers.new())
174+
iex> response.status
175+
404
176+
iex> response.status_text
177+
"Not Found"
178+
iex> response.ok
179+
false
179180
"""
180181
@spec new(keyword()) :: t()
181182
def new(opts \\ []) do

0 commit comments

Comments
 (0)