Skip to content

Commit 2d34fd2

Browse files
authored
Merge pull request #17 from racket/weaken-response-contract
Weaken the contract on response-output to permit any return value
2 parents 250e256 + a93685d commit 2d34fd2

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

web-server-doc/web-server/scribblings/http.scrbl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ Here is an example typical of what you will find in many applications:
173173
[seconds number?]
174174
[mime (or/c false/c bytes?)]
175175
[headers (listof header?)]
176-
[output (output-port? . -> . void)])]{
176+
[output (output-port? . -> . any)])]{
177177

178178
An HTTP response where @racket[output] produces the body by writing to
179179
the output port. @racket[code] is the response code, @racket[message]
@@ -214,6 +214,10 @@ Examples:
214214
#"http://racket-lang.org/download"))
215215
void)
216216
]
217+
218+
@history[#:changed "1.2"
219+
@elem{Contract on @racket[output] weaked to allow @racket[any]
220+
as the result (instead of demanding @racket[void?]).}]
217221
}
218222

219223
@defproc[(response/full [code number?] [message bytes?] [seconds number?] [mime (or/c false/c bytes?)]
@@ -236,7 +240,7 @@ Examples:
236240
]
237241
}
238242

239-
@defproc[(response/output [output (-> output-port? void?)]
243+
@defproc[(response/output [output (-> output-port? any)]
240244
[#:code code number? 200]
241245
[#:message message bytes? #"Okay"]
242246
[#:seconds seconds number? (current-seconds)]
@@ -245,6 +249,10 @@ Examples:
245249
response?]{
246250
Equivalent to
247251
@racketblock[(response code message seconds mime-type headers output)]
252+
253+
@history[#:changed "1.2"
254+
@elem{Contract on @racket[output] weaked to allow @racket[any]
255+
as the result (instead of demanding @racket[void?]).}]
248256
}
249257

250258
@defthing[TEXT/HTML-MIME-TYPE bytes?]{Equivalent to @racket[#"text/html; charset=utf-8"].}

web-server-lib/info.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
(define pkg-authors '(jay))
1616

17-
(define version "1.1")
17+
(define version "1.2")

web-server-lib/web-server/http/response-structs.rkt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
[seconds number?]
3737
[mime (or/c false/c bytes?)]
3838
[headers (listof header?)]
39-
[output (output-port? . -> . void)])]
39+
[output (output-port? . -> . any)])]
4040
[response/full (-> number? bytes? number? (or/c false/c bytes?) (listof header?) (listof bytes?) response?)]
41-
[response/output (->* ((-> output-port? void?))
41+
[response/output (->* ((-> output-port? any))
4242
(#:code number?
4343
#:message bytes?
4444
#:seconds number?

0 commit comments

Comments
 (0)