Ah, that makes sense. You could think about providing match patterns for each of the HTTP methods, in that case -- people might be less confused by that than strings.
On Fri, Jan 4, 2013 at 10:30 AM, Jay McCarthy <j...@racket-lang.org> wrote: > The programmer's input is not a string. It is a match pattern, so you can > use 'or', '_', etc. > > > On Fri, Jan 4, 2013 at 6:30 AM, Sam Tobin-Hochstadt <sa...@ccs.neu.edu> > wrote: >> >> Why not normalize this at the other end (ie, normalize the provided >> string as well as the actual method) so that "GET" as well as "get" >> will work? >> >> Sam >> >> On Fri, Jan 4, 2013 at 7:45 AM, <j...@racket-lang.org> wrote: >> > jay has updated `master' from aa5f2e7875 to c07ff948ee. >> > http://git.racket-lang.org/plt/aa5f2e7875..c07ff948ee >> > >> > =====[ One Commit ]===================================================== >> > Directory summary: >> > 100.0% collects/web-server/scribblings/ >> > >> > ~~~~~~~~~~ >> > >> > c07ff94 Jay McCarthy <j...@racket-lang.org> 2013-01-04 05:44 >> > : >> > | Fixes PR13406 >> > : >> > M collects/web-server/scribblings/dispatch.scrbl | 11 +++++++++-- >> > >> > =====[ Overall Diff ]=================================================== >> > >> > collects/web-server/scribblings/dispatch.scrbl >> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> > --- OLD/collects/web-server/scribblings/dispatch.scrbl >> > +++ NEW/collects/web-server/scribblings/dispatch.scrbl >> > @@ -118,6 +118,7 @@ or else the filesystem server will never see the >> > requests. >> > [maybe-method >> > code:blank >> > (code:line #:method method)] >> > + [method pat] >> > [maybe-else-clause >> > code:blank >> > [else else-fun]]) >> > @@ -137,9 +138,15 @@ the @racket[dispatch-fun] given as its first >> > argument. >> > @racket[(next-dispatcher)] to signal to the Web Server that this >> > dispatcher does not apply. >> > >> > - If any @racket[_method] is left out, it assumed to apply to requests >> > -without methods and GET methods. >> > + The @racket[_method] syntax is used in a @racket[match] expression to >> > +match the @racket[request-method] part of the incoming request >> > +object. However, since HTTP allows methods to use any case, the byte >> > +string from @racket[request-method] is normalized to a lower-case >> > +string. Thus, valid patterns are things like: @racket["get"], >> > +@racket["post"], @racket["head"], @racket[(or "get" "post")], etc. >> > >> > + If @racket[_method] is left out, it assumed to apply to requests >> > +without methods and GET methods. >> > } >> > >> > @defform[ > > _________________________ Racket Developers list: http://lists.racket-lang.org/dev