summaryrefslogtreecommitdiff
path: root/tests/client-manifest-not-modified.scm
blob: 440c9b8f422830784c5578af312aa7a2275ef5d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
(use-modules (webid-oidc client)
             (webid-oidc testing)
             (webid-oidc errors)
             (web uri)
             (srfi srfi-19)
             (web request)
             (web response)
             (ice-9 optargs)
             (ice-9 receive))

(with-test-environment
 "client-manifest-not-modified"
 (lambda ()
   (let ((handler (serve-application
                   (string->uri "https://example.com/manifest")
                   (string->uri "https://example.com/authorized"))))
     (receive (response response-body)
         (handler (build-request (string->uri "https://example.com/manifest"))
                  "")
       (let ((etag (response-etag response)))
         (unless etag
           (exit 1))
         (receive (second-response second-response-body)
             (handler (build-request (string->uri "https://example.com/manifest")
                                     #:headers `((if-none-match . (,etag))))
                      "")
           (unless (eqv? (response-code second-response) 304)
             (exit 2))))))))