Fixing problem reported by Nadeem Abdul Hamid
This commit is contained in:
parent
df68ef4deb
commit
f2b5a454bd
29
collects/tests/web-server/pr/bsl.rkt
Normal file
29
collects/tests/web-server/pr/bsl.rkt
Normal file
|
@ -0,0 +1,29 @@
|
|||
#lang racket
|
||||
(require net/url
|
||||
rackunit
|
||||
tests/eli-tester
|
||||
htdp/bsl/reader
|
||||
web-server/servlet/web)
|
||||
(require/expose web-server/servlet/web
|
||||
(embed-ids))
|
||||
(require/expose htdp/bsl/reader
|
||||
(wrap-reader))
|
||||
|
||||
(define base-url
|
||||
(string->url
|
||||
"http://localhost:8000/servlets/standalone.rkt"))
|
||||
(define a-k-url
|
||||
(string->url
|
||||
"http://localhost:8000/servlets/standalone.rkt;((%22k%22%20.%20%22(1%201%2033620206)%22))"))
|
||||
(define k-info
|
||||
'(1 1 33620206))
|
||||
|
||||
(define (can-encode?)
|
||||
(test
|
||||
(continuation-url? a-k-url) => k-info
|
||||
(embed-ids k-info base-url) => (url->string a-k-url)))
|
||||
|
||||
(test
|
||||
(can-encode?)
|
||||
((wrap-reader can-encode? empty)))
|
||||
|
|
@ -23,11 +23,12 @@
|
|||
;; determine if this url encodes a continuation and extract the instance id and
|
||||
;; continuation id.
|
||||
(define (continuation-url? a-url)
|
||||
(cond
|
||||
[(extract-param a-url "k")
|
||||
=> read/string]
|
||||
[else
|
||||
#f]))
|
||||
(parameterize ([read-accept-dot #t])
|
||||
(cond
|
||||
[(extract-param a-url "k")
|
||||
=> read/string]
|
||||
[else
|
||||
#f])))
|
||||
|
||||
(provide/contract
|
||||
[continuation-url? (url? . -> . (or/c false/c (list/c number? number? number?)))])
|
||||
|
|
Loading…
Reference in New Issue
Block a user